[4.1-dev] fix: resolve comma-joined tables in nested explicit JOIN ON conditions#25360
Open
aunjgr wants to merge 3 commits into
Open
[4.1-dev] fix: resolve comma-joined tables in nested explicit JOIN ON conditions#25360aunjgr wants to merge 3 commits into
aunjgr wants to merge 3 commits into
Conversation
When comma (CROSS) join syntax is mixed with explicit JOIN (e.g. FROM a, b JOIN c ON a.x = c.y), the parser produces CROSS(a, INNER(b, c, ON a.x = c.y)). The outer left context containing 'a' was lost when buildTable dispatched to buildJoinTable for the nested INNER join. Fix: pass extLeftCtx through to buildJoinTable, temporarily add its bindings to ctx for ON condition resolution, then remove them so the outer mergeContexts doesn't see a duplicate. Co-Authored-By: Claude <noreply@anthropic.com>
The extBindingsRestore was only called inside OnJoinCond, but comma joins have no ON condition — extLeftCtx bindings leaked into ctx and collided at outer mergeContexts. Move restore after the switch so all join types clean up. Co-Authored-By: Claude <noreply@anthropic.com>
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
heni02
approved these changes
Jul 2, 2026
ouyuanning
approved these changes
Jul 2, 2026
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.
What type of PR is this?
Which issue(s) this PR fixes:
issue #24411
What this PR does / why we need it:
FROM a, b JOIN c ON a.x = c.yfailed with "missing FROM-clause entry". Cherry-pick of #25353 to 4.1-dev.buildJoinTable now accepts extLeftCtx, temporarily adds bindings for ON condition resolution, then removes them before the outer mergeContexts.
pkg/sql/plan/query_builder.gopkg/sql/plan/build_test.gotest/.../join/join.sql🤖 Generated with Claude Code