-
Notifications
You must be signed in to change notification settings - Fork 969
feat: do not add a group by clause to O2O-edges for order by neighbor… #3943
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
base: master
Are you sure you want to change the base?
feat: do not add a group by clause to O2O-edges for order by neighbor… #3943
Conversation
@giautm can you help review this change? |
GroupBy(toT.C(s.Edge.Columns[0])) | ||
From(toT) | ||
if s.Edge.Rel != O2O { | ||
join = join.GroupBy(toT.C(s.Edge.Columns[0])) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That’s true if the edge is unique, not only o2o.
Also, please add/update tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@a8m Do you have ideas for tests? It looks like there is already a test that covers ordering by a unique edge field, but all the tests use sqlite, and therefore this specific test passed both before and after this change. This change is only to generate valid sql in other databases too, such as PostgreSQL.
b03b063
to
9d599d5
Compare
… terms this prevents issues with databases that require all selected terms be included in the group by clause. the group by clause is not required if the relationship is O2O, because only one row will be returned if we join on fks.
9d599d5
to
ee6caa7
Compare
This modification is extremely helpful. In PostgreSQL, attempting to use ORDER BY on an edge results in an error: "pq: column 'xxx' must appear in the GROUP BY clause or be used in an aggregate function". I believe this is a bug that requires urgent resolution. Thank you very much. @a8m |
I'm waiting for that fix too, have the same issue when trying to add ORDER BY edge field to my schema. Edge to:
Edge from:
Bad SQL in result:
|
… terms
this prevents issues with databases that require all selected terms be included in the group by clause. the group by clause is not required if the relationship is O2O, because only one row will be returned if we join on fks.