Skip to content

fix-join-without-on-clause-panic - #794

Merged
general-kroll-4-life merged 1 commit into
mainfrom
fix/join-without-on-panic
Sep 25, 2026
Merged

general-kroll-4-life merged 1 commit into
mainfrom
fix/join-without-on-panic

Conversation

@jeffreyaven

Copy link
Copy Markdown
Member

Summary

Fixes #793.

A JOIN with no ON clause crashed plan building with an unrecovered nil pointer dereference in the early-analysis visitor (ast_expand.go), taking down shell, srv and MCP sessions. CROSS JOIN hit the same path because the parser folds it into the plain join string.

Changes:

  • earlyanalysis/ast_expand.go: guard the nil On expression before visiting it, matching the convention already used in the other visitors.
  • astvisit/param_extract.go: same guard on the one remaining unguarded Condition.On.Accept call.
  • astvisit/from_rewrite.go: render a condition-less inner join as CROSS JOIN instead of emitting a dangling ON. Postgres rejects a bare JOIN without ON, sqlite treats it as a cross join, so spelling it out keeps both backends happy. The hoisted-parameter ON ( placeholder ) path is preserved when the planner injects one.

Behaviour: JOIN without ON is now a cross join, as in sqlite, so the join condition can live in WHERE.

Test plan

  • New robot scenario Inner Join Without ON Clause Is Treated As Cross Join in the mocked functional suite: joins aws.iam.users to googleadmin.directory.users with the condition in WHERE, with sqlite and postgres input variants. Verified locally that it panics on the unpatched main binary and passes with this change.
  • Existing join scenarios (inline LHS joins, cross-cloud fuzzy match, network infra hoisted-ON and data-flow scenarios) pass locally against the patched binary.
  • Manual check against the real homebrew provider for the issue's exact query, the no-WHERE form, explicit CROSS JOIN, and the ON 1 = 1 control.
  • golangci-lint (pinned 2.5.0) clean on the touched packages; go test green for astanalysis/....

🤖 Generated with Claude Code

A JOIN with no ON clause crashed plan building with a nil pointer
dereference in the early-analysis visitor. Guard the nil ON expression
in the two unguarded visitors and render a condition-less inner join as
CROSS JOIN so both sqlite and postgres accept it. Adds a robot scenario
that joins two provider tables with the condition in WHERE.

Fixes #793

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@general-kroll-4-life
general-kroll-4-life merged commit 4a4d0b5 into main Sep 25, 2026
30 checks passed
@general-kroll-4-life
general-kroll-4-life deleted the fix/join-without-on-panic branch September 25, 2026 10:09
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.

[BUG] JOIN without ON clause panics (nil pointer dereference in earlyanalysis ast_expand.go)

2 participants