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

feat: add related orders #2511

Merged
merged 2 commits into from
Nov 8, 2022
Merged

Conversation

steve-chavez
Copy link
Member

@steve-chavez steve-chavez commented Oct 13, 2022

Closes #1414

Allows ordering a table by a related table

GET /projects?select=id,clients(name)&order=clients(name).nullsfirst

[
  {"id":5,"clients":null},
  {"id":3,"clients":{"name":"Apple"}},
  {"id":4,"clients":{"name":"Apple"}},
  {"id":1,"clients":{"name":"Microsoft"}},
  {"id":2,"clients":{"name":"Microsoft"}} 
]        

On many-to-one and one-to-one relationships

@steve-chavez steve-chavez force-pushed the top-orders branch 3 times, most recently from ea7a7a8 to 139df7b Compare November 2, 2022 23:24
@steve-chavez steve-chavez changed the title feat: order parent by child's column feat: add related orders Nov 2, 2022
@steve-chavez steve-chavez marked this pull request as ready for review November 2, 2022 23:26
@steve-chavez
Copy link
Member Author

I think this one is ready to merge but will wait for #2558 to make a patch release.

src/PostgREST/Error.hs Outdated Show resolved Hide resolved
test/spec/fixtures/data.sql Outdated Show resolved Hide resolved
@steve-chavez
Copy link
Member Author

I thought we might lose perf since there is an additional step in the plan but looking at the load test results

param main head
throughput 312.7464664663987 318.61733744535746

Seems perf is not lost.

@steve-chavez steve-chavez merged commit 78d45b4 into PostgREST:main Nov 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Order parent by child's column (for to-one mapping)
2 participants