Skip to content

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

Merged
DanRibbens merged 3 commits into
mainfrom
fix/date-filter
May 12, 2025
Merged

fix(db-postgres): selectDistinct might remove expected rows when querying with nested fields or relations#12365
DanRibbens merged 3 commits into
mainfrom
fix/date-filter

Conversation

@r1tsuu

@r1tsuu r1tsuu commented May 9, 2025

Copy link
Copy Markdown
Member

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.
@github-actions

Copy link
Copy Markdown
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