sql: fix wrong results for JOIN ... USING (col) AS t with RIGHT/FULL joins#36606
Open
ggevay wants to merge 1 commit into
Open
sql: fix wrong results for JOIN ... USING (col) AS t with RIGHT/FULL joins#36606ggevay wants to merge 1 commit into
ggevay wants to merge 1 commit into
Conversation
…joins In plan_using_constraint, when an AS alias is present on a USING clause, the qualified reference t.col was unconditionally bound to the LHS column's value. For RIGHT and FULL OUTER joins, rows with no LHS match have a NULL LHS, so t.col returned NULL instead of the joined value. Choose the source of the aliased column based on JoinKind, matching the choice already made for the unaliased join output column a few lines above: - INNER / LEFT -> lhs - RIGHT -> rhs - FULL OUTER -> COALESCE(lhs, rhs) Fixes a regression introduced in MaterializeInc#18793. Co-authored-by: Junie <junie@jetbrains.com>
07adf7c to
82fd9e2
Compare
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.
Fixes SQL-279