Skip to content
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

Postgres Error with "SELECT DISTINCT, ORDER BY" #128

Open
Skulli opened this issue Apr 19, 2013 · 4 comments
Open

Postgres Error with "SELECT DISTINCT, ORDER BY" #128

Skulli opened this issue Apr 19, 2013 · 4 comments
Labels

Comments

@Skulli
Copy link

Skulli commented Apr 19, 2013

The Problem is the "order by (case.." statement which is used in arrange-method for example.

If i query an ancestry Class like

Section.scoped.uniq.arrange

(i know the statement doest make much sense but just an example).

It will throw following error when using postgres:

PG::Error: ERROR:  for SELECT DISTINCT, ORDER BY expressions must appear in select list

It would be correct if the case statement is put into the select and aliased and then accessed in the ORDER BY statement.

@tzar
Copy link

tzar commented May 7, 2013

+1

tzar added a commit to tzar/ancestry that referenced this issue May 7, 2013
Move case statement into part of the select. Fixes stefankroes#128
@tzar
Copy link

tzar commented May 7, 2013

Ignore the above commit, creates issues with some other cases

tzar added a commit to tzar/ancestry that referenced this issue May 7, 2013
Amendment to last fix for stefankroes#128. It doesn't feel clean at all,
but it makes it work for my use case at least.
@StefanH
Copy link
Collaborator

StefanH commented May 7, 2013

This would probably be fixed by #131, right? in that case I would like to close this issue and use that solution

@tzar
Copy link

tzar commented May 7, 2013

@StefanH ah yeah, it would be fixed by that. Does mysql need the case statement still though?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants