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

ensure the LEFT JOIN behaves as expected #623

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

bwdmr
Copy link

@bwdmr bwdmr commented Jan 2, 2025

The WHERE clause will filter out these rows because NULL values do not satisfy either the IS NULL or the greater than conditions, effectively excluding them from the result set.

Turning the LEFT JOIN into an INNER JOIN for rows where NULL values would have been expected.

  • move includeDeleted checks from query to join, where the filter will be applied
  • copy filters over and add filter as necessary, on case deleted in not included
  • keep includeDeleted checks within query aswell, as null checks now can exists in where clause aswell.
  • adjust tests to reflect changes in code.

The WHERE clause will filter out these rows because NULL values do not satisfy either the IS NULL or the greater than conditions, effectively excluding them from the result set.

Turning the LEFT JOIN into an INNER JOIN for rows where NULL values would have been expected.

* move includeDeleted checks from query to join, where the filter will be applied
* copy filters over and add filter as necessary, on case deleted in not included
* keep includeDeleted checks within query aswell, as null checks now can exists in where clause aswell.
* adjust tests to reflect changes in code.
@bwdmr bwdmr requested a review from gwynne as a code owner January 2, 2025 13:02
Sources/FluentKit/Properties/Timestamp.swift Outdated Show resolved Hide resolved
Sources/FluentKit/Properties/Timestamp.swift Outdated Show resolved Hide resolved
Sources/FluentKit/Query/Builder/QueryBuilder+Join.swift Outdated Show resolved Hide resolved
Sources/FluentKit/Query/Builder/QueryBuilder.swift Outdated Show resolved Hide resolved
@bwdmr bwdmr force-pushed the leftjointimestamp branch from 7c4f2c7 to 88fbec7 Compare January 19, 2025 14:45
@bwdmr bwdmr requested a review from gwynne January 19, 2025 14:46
@bwdmr bwdmr force-pushed the leftjointimestamp branch from 33236f1 to 983cd12 Compare January 20, 2025 01:11
@bwdmr bwdmr requested a review from 0xTim January 23, 2025 05:01
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.

3 participants