-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
PG error with v3.2.0 #519
Comments
Can you write a script to reproduce this error ? |
Sorry I am newbie, what do you mean by a script? |
A rails application with only the models that causing the error (you can strip out all logic from it) try to remove : .order(mylike: :desc) |
@aoredo Any example code. The model, the schema for the model, the relevant code in the model, the db type and version, the rails version, command you're running when you get the error, the backtrace |
This reproduces it... User.order("lower(lname) asc") produces I believe the addition of the DISTINCT argument is causing the issue. |
Ok, i will try to resolve this, once i have free time. |
I have this problem too. Probably because of DISTINCT when I try to ORDER by some fields not in SELECT DISTINCT operation. |
@dkonayuki Can you provide a dummy application with the issue ?? |
FYI, I'm running on the same issue. Any model that uses |
Hello,
I am getting this error while generating a tag_cloud from a tagged_with instance when upgraded to 3.2.0.
_Error_*
ActionView::Template::Error (PG::InvalidColumnReference: ERROR: for SELECT DISTINCT, ORDER BY expressions must appear in select list
LINE 1: ...' AND media_taggings_b910fb9.tag_id = 1 ORDER BY "media"."m...
^
: SELECT COUNT(*) FROM "tags" JOIN (SELECT taggings.tag_id, COUNT(taggings.tag_id) AS tags_count FROM "taggings" INNER JOIN media ON media.id = taggings.taggable_id WHERE (taggings.taggable_type = 'Media' AND taggings.context = 'tags') AND (taggings.taggable_id IN(SELECT DISTINCT media.id FROM "media" JOIN taggings media_taggings_b910fb9 ON media_taggings_b910fb9.taggable_id = "media".id AND media_taggings_b910fb9.taggable_type = 'Media' AND media_taggings_b910fb9.tag_id = 1 ORDER BY "media"."mylike" DESC LIMIT 24 OFFSET 0)) GROUP BY taggings.tag_id HAVING COUNT(taggings.tag_id) > 0) AS taggings ON taggings.tag_id = tags.id):
The text was updated successfully, but these errors were encountered: