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 after distinct queries (option 2) #20125

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

Conversation

innerdvations
Copy link
Contributor

@innerdvations innerdvations commented Apr 16, 2024

Alternative solution: #20124

What does it do?

After performing a query that is supposed to be distinct but should actually probably be a groupBy, we apply the same groupBy on the resultset received, in Node rather than the db query.

NOTE: on further review and discussion, this will probably break pagination with a resultset that exceeds the size of one page.

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 nested populates and queries with joins and distincts that aren't the typical path we use.

Related issue(s)/PR(s)

Alternative solution: #20124

Fixes #11892

DX-117

@innerdvations innerdvations added source: core:database Source is core/database package pr: fix This PR is fixing a bug labels Apr 16, 2024
@innerdvations innerdvations added this to the 4.23.2 milestone Apr 16, 2024
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:14pm

@innerdvations innerdvations changed the title fix(database): Add groupBy after non-join queries (option 2) fix(database): Add groupBy after distinct queries (option 2) Apr 16, 2024
@innerdvations innerdvations added the flag: don't merge This PR should not be merged at the moment label Apr 22, 2024
@innerdvations innerdvations marked this pull request as draft April 24, 2024 15:10
@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