Skip to content

Instantly share code, notes, and snippets.

@johnpmitsch
Created August 10, 2020 23:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johnpmitsch/97213f1f4a6b27f8e17f21d96cdd01de to your computer and use it in GitHub Desktop.
Save johnpmitsch/97213f1f4a6b27f8e17f21d96cdd01de to your computer and use it in GitHub Desktop.
sql query
error
```
2020-08-10 14:51:58 UTC ERROR: subquery has too many columns at character 79
2020-08-10 14:51:58 UTC STATEMENT: SELECT COUNT(*) FROM "katello_repositories" WHERE "katello_repositories"."id" IN (SELECT DISTINCT katello_repositories.*,
CASE
WHEN katello_content_view_repositories.content_view_id = 4 THEN 1
ELSE 0
END AS "added_to_content_view"
, "katello_repositories"."id" FROM katello_repositories LEFT JOIN katello_content_view_repositories ON (katello_repositories.id = katello_content_view_repositories.repository_id) LEFT JOIN katello_content_views ON (katello_content_view_repositories.content_view_id = katello_content_views.id) WHERE ( katello_content_views.id = 4 OR katello_content_views.id IS NULL
) ORDER BY added_to_content_view DESC, katello_repositories.id
)
2020-08-10 14:52:39 UTC ERROR: syntax error at or near "AS" at character 185
2020-08-10 14:52:39 UTC STATEMENT: SELECT COUNT( DISTINCT katello_repositories.*,
CASE
WHEN katello_content_view_repositories.content_view_id = 4 THEN 1
ELSE 0
END AS "added_to_content_view"
) FROM katello_repositories LEFT JOIN katello_content_view_repositories ON (katello_repositories.id = katello_content_view_repositories.repository_id) LEFT JOIN katello_content_views ON (katello_content_view_repositories.content_view_id = katello_content_views.id) WHERE ( katello_content_views.id = 4 OR katello_content_views.id IS NULL
)
```
seems like its a known bug https://github.com/rails/rails/issues/36402
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment