Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

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

Open
Skulli opened this Issue · 4 comments

3 participants

@Skulli

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

+1

@tzar tzar referenced this issue from a commit in tzar/ancestry
@tzar tzar Modify ancestry order scopes to work with SELECT DISTINCT
Move case statement into part of the select. Fixes #128
be7c927
@tzar

Ignore the above commit, creates issues with some other cases

@tzar tzar referenced this issue from a commit in tzar/ancestry
@tzar tzar Add in default select for ancestry ordered scope
Amendment to last fix for #128. It doesn't feel clean at all,
but it makes it work for my use case at least.
a0aa344
@StefanH
Collaborator

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

@tzar

@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
Something went wrong with that request. Please try again.