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

fix(database): Add groupBy to queries with joins (option 1) #20124

Draft
wants to merge 5 commits into
base: develop
Choose a base branch
from

Conversation

innerdvations
Copy link
Contributor

@innerdvations innerdvations commented Apr 16, 2024

Alternative solution: #20125

What does it do?

Removes duplicate results from sorts on relation fields by applying a groupBy on all select statements that don't have one

TODO:

  • fix that it breaks components queries

Why is it needed?

Fixes #11892

How to test it?

See the original issue.

A test of sort has been added to prevent regressions, but this may have unintended side effects that are not caught by existing tests, so a pretty thorough test of the content API, admin API, pretty much anything that makes queries.

Related issue(s)/PR(s)

Alternative solution: #20125

Fixes #11892

DX-117

Copy link

vercel bot commented Apr 16, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
contributor-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 16, 2024 2:16pm

@innerdvations innerdvations changed the title fix(database): Add groupBy to non-join queries (option 1) fix(database): Add groupBy to queries with joins (option 1) Apr 16, 2024
@Marc-Roig
Copy link
Contributor

I personally like this option more than option 1, it fixes the problem directly on the db query and I don't think it will impact performance

@innerdvations
Copy link
Contributor Author

I may need someone (you?) to sit with me and figure out more precise ways to target where we want to do this. Right now it's breaking components. And I feel like if I fix that case, I'll still keep playing whack-a-mole until our tests pass, and still might miss something.

@innerdvations innerdvations added the flag: don't merge This PR should not be merged at the moment label Apr 22, 2024
@joshuaellis joshuaellis removed this from the 4.24.1 milestone May 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flag: don't merge This PR should not be merged at the moment pr: fix This PR is fixing a bug source: core:database Source is core/database package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[v4] sort by graphql duplicating rows
3 participants