Repository navigation
feat(analysis): accept any boolean expression as a join ON condition - #72
Merged
omer-cengel merged 1 commit intoOct 11, 2026
Merged
Conversation
A join's ON condition is no longer limited to one qualified equality. Composite-key joins, filtered joins, comparisons other than equality and ON TRUE compile. Every column of the condition outside a nested SELECT resolves against the sources introduced up to and including the joined source. Its placeholders are typed by the WHERE rules and bind in textual order. A join without ON, or with two ON conditions, is rejected with "A join requires one ON condition." Left-joined columns stay nullable whatever the condition filters.
omer-cengel
deleted the
feature/join-conditions-of-any-boolean-expression
branch
October 11, 2026 12:05
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A join's
ONcondition was limited to one qualified equality between the joined source and an earlier one. Common queries such as composite-key joins, filtered left joins andON TRUEwere therefore rejected. An inner or left join may now carry any boolean expression in itsONcondition, and its placeholders are typed the same way as inWHERE.Changes
ONcondition of any boolean expression, including composite keys, comparisons other than equality, conditions over one source, unqualified columns andON TRUE.SELECT, resolves against the sources introduced up to and including the joined source. A reference to a later source fails as an unknown source qualifier, and an unknown column fails as before.WHEREpredicate rules, in both placeholder forms. Cast placeholders state their own type. Every placeholder binds in textual order, so anONplaceholder binds before aWHEREone.ON, and the nestedJOIN a JOIN b ON x ON yform, are rejected withA join requires one ON condition.Scope and non-goals
RIGHT,FULL,CROSS,USING,NATURAL, comma-separated andLATERALjoins keep their current rejection.SELECTinsideONis not analyzed, apart from cast placeholders.WHERErules cannot type, such aslower(p.nickname) = :n, keeps its existing rejection.RETURNINGand the rest ofWHEREanalysis are unchanged.