New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Oracle database raises ORA-00904 if group by clause uses alias name #36613
Comments
ORA-00904 is due to
Here are SQL statement differences between master branch and 5-2-stable branch.
SELECT COUNT(DISTINCT comments.id) AS count_comments_id, "POSTS"."TYPE" AS posts_type FROM "POSTS" LEFT OUTER JOIN "COMMENTS" ON "COMMENTS"."POST_ID" = "POSTS"."ID" GROUP BY posts_type FETCH FIRST :a1 ROWS ONLY [["LIMIT", 2]]
SELECT COUNT(DISTINCT comments.id) AS count_comments_id, "POSTS"."TYPE" AS posts_type FROM "POSTS" LEFT OUTER JOIN "COMMENTS" ON "COMMENTS"."POST_ID" = "POSTS"."ID" GROUP BY "POSTS"."TYPE" FETCH FIRST :a1 ROWS ONLY [["LIMIT", 2]] |
It looks like this behavior change is introduced at c9e4c84 |
It appears that Oracle does not allow using aliases in GROUP BY clause unlike ORDER BY clause. Fixes rails#36613.
This issue is originally reported to rsim/oracle-enhanced#1899 .
Steps to reproduce
Expected behavior
It should pass as Rails 5-2-stable branch does.
Actual behavior
System configuration
Rails version:
master
and6-0-stable
branchRuby version:ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-linux]
The text was updated successfully, but these errors were encountered: