Skip to content

feat(analysis): accept LEFT JOIN with nullable joined columns - #33

Merged
omer-cengel merged 2 commits into
masterfrom
feature/left-join-nullable-columns
Sep 25, 2026
Merged

omer-cengel merged 2 commits into
masterfrom
feature/left-join-nullable-columns

Conversation

@omer-cengel

Copy link
Copy Markdown
Member

Summary

Reads can now use LEFT JOIN (and its LEFT OUTER JOIN spelling) with the same single qualified ON equality already required for inner joins. Because an unmatched row supplies no value for the joined table, every column projected from a left-joined source is analyzed as nullable, so the generated result reports null components for unmatched rows instead of claiming a non-null value.

Changes

  • Accept LEFT JOIN and LEFT OUTER JOIN alongside JOIN/INNER JOIN, chained with inner joins in any order, keeping the existing ON equality rules and diagnostics.
  • Mark every column read from a left-joined source as nullable in direct, aliased, qualifier.*, and * projections, even when the schema declares it NOT NULL; the base and inner-joined sources keep their schema nullability.
  • Update the unsupported-join diagnostic to Only unmodified INNER JOIN and LEFT JOIN clauses are supported.
  • Add analyzer tests for both spellings, wildcard expansion, join chaining, parameters, and the join kinds and ON shapes that stay rejected, plus a PostgreSQL integration test that compiles and runs a left join returning null components for an unmatched row.
  • Document the accepted joins, their nullability, and the rejected forms in the query and PostgreSQL guides.

Scope and non-goals

  • RIGHT, FULL, bare OUTER, NATURAL, SEMI, APPLY, USING (...), comma-separated sources, and non-table join sources remain rejected.
  • Join predicates beyond one qualified equality are not supported, and a later inner join does not narrow the nullability of a left-joined source.
  • Parameters, binding order, the generator, and the runtime are unchanged; joined reads still generate a query-specific result record.

@omer-cengel
omer-cengel merged commit 274d721 into master Sep 25, 2026
6 checks passed
@omer-cengel
omer-cengel deleted the feature/left-join-nullable-columns branch September 25, 2026 17:35
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.

1 participant