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: nested some filters should work #4968

Merged
merged 3 commits into from
Aug 12, 2024
Merged

fix: nested some filters should work #4968

merged 3 commits into from
Aug 12, 2024

Conversation

Weakky
Copy link
Contributor

@Weakky Weakky commented Jul 31, 2024

Overview

fixes prisma/prisma#23742

@Weakky Weakky marked this pull request as ready for review July 31, 2024 11:34
@Weakky Weakky requested a review from a team as a code owner July 31, 2024 11:34
@Weakky Weakky requested review from SevInf and removed request for a team July 31, 2024 11:34
Comment on lines +651 to +654
Filter::Relation(x) => vec![join_fields(&x.field), extract_filter_scalars(&x.nested_filter)]
.into_iter()
.flatten()
.collect(),
Copy link
Contributor Author

@Weakky Weakky Jul 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

relationJoins queries generate multi-level select statements. Filters are done at a specific level, which requires the select builder to ensure the most nested select statements projects all the fields required for filters to be applied at a higher level. In the case of some, we were not projecting the scalar fields used in relational filters.

eg:

where: { to-many: { some: { id: 1 } } }

id field needs to be selected from inner selects.

Copy link
Contributor

github-actions bot commented Jul 31, 2024

WASM Query Engine file Size

Engine This PR Base branch Diff
Postgres 2.058MiB 2.057MiB 948.000B
Postgres (gzip) 821.020KiB 820.453KiB 581.000B
Mysql 2.028MiB 2.027MiB 948.000B
Mysql (gzip) 808.683KiB 808.035KiB 664.000B
Sqlite 1.919MiB 1.919MiB 0.000B
Sqlite (gzip) 766.277KiB 766.277KiB 0.000B

@Weakky Weakky added this to the 5.18.0 milestone Jul 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Relation joins doesn't like nested some clauses
2 participants