Skip to content

fix(db-postgres): selectDistinct might remove expected rows when querying with nested fields or relations #12365

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

Merged
merged 3 commits into from
May 12, 2025

Conversation

r1tsuu
Copy link
Member

@r1tsuu r1tsuu commented May 9, 2025

Fixes #12263
This was caused by passing not needed columns to the SELECT DISTINCT query, which we execute in case if we have a filter / sort by a nested field / relationship. Since the only columns that we need to pass to the SELECT DISTINCT query are: ID and field(s) specified in sort, we now filter the selectFields variable.

@r1tsuu r1tsuu requested a review from DanRibbens May 9, 2025 14:51
@r1tsuu r1tsuu changed the title fix(db-postgres): selectDistinct might remove expected rows when querying with nested fields or relations fix(db-postgres): selectDistinct might remove expected rows when querying with nested fields or relations May 9, 2025
@r1tsuu r1tsuu changed the title fix(db-postgres): selectDistinct might remove expected rows when querying with nested fields or relations fix(db-postgres): selectDistinct might remove expected rows when querying with nested fields or relations May 9, 2025
@r1tsuu r1tsuu changed the title fix(db-postgres): selectDistinct might remove expected rows when querying with nested fields or relations fix(db-postgres): selectDistinct might remove expected rows when querying with nested fields or relations May 9, 2025
@r1tsuu r1tsuu changed the title fix(db-postgres): selectDistinct might remove expected rows when querying with nested fields or relations fix(db-postgres): selectDistinct might remove expected rows when querying with nested fields or relations May 9, 2025
@r1tsuu r1tsuu changed the title fix(db-postgres): selectDistinct might remove expected rows when querying with nested fields or relations fix(db-postgres): selectDistinct might remove expected rows when querying with nested fields or relations May 12, 2025
@DanRibbens DanRibbens merged commit 8219c04 into main May 12, 2025
78 checks passed
@DanRibbens DanRibbens deleted the fix/date-filter branch May 12, 2025 19:34
kendelljoseph pushed a commit that referenced this pull request May 15, 2025
…ying with nested fields or relations (#12365)

Fixes #12263
This was caused by passing not needed columns to the `SELECT DISTINCT`
query, which we execute in case if we have a filter / sort by a nested
field / relationship. Since the only columns that we need to pass to the
`SELECT DISTINCT` query are: ID and field(s) specified in `sort`, we now
filter the `selectFields` variable.
Copy link
Contributor

🚀 This is included in version v3.38.0

kendelljoseph pushed a commit that referenced this pull request May 19, 2025
…ying with nested fields or relations (#12365)

Fixes #12263
This was caused by passing not needed columns to the `SELECT DISTINCT`
query, which we execute in case if we have a filter / sort by a nested
field / relationship. Since the only columns that we need to pass to the
`SELECT DISTINCT` query are: ID and field(s) specified in `sort`, we now
filter the `selectFields` variable.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

LocalAPI: paginated query with a filter on a date field inside an array field does not retrieve all docs of the queried page
2 participants