Skip to content

SQLite: Support ON and USING after a comma join - #2667

Open
LucaCappelletti94 wants to merge 2 commits into
mainfrom
sqlite-comma-join-constraints
Open

LucaCappelletti94 wants to merge 2 commits into
mainfrom
sqlite-comma-join-constraints

Conversation

@LucaCappelletti94

Copy link
Copy Markdown
Contributor

In SQLite the comma between tables is a join operator, and every join operator may be followed by a join constraint (https://www.sqlite.org/syntax/join-clause.html). SQLite 3.51.1 runs SELECT * FROM t, u ON t.a = u.a, SELECT * FROM t, u USING (a) and chains such as t, u ON ..., v ON ..., while PostgreSQL 16 and DuckDB 1.4.4 reject all of them. The SQLite dialect failed with Expected: end of statement, found: ON.

A new dialect method, supports_comma_join_constraint, is enabled for SQLite and the generic dialect. When the table after a comma is followed by ON or USING, the FROM list parser turns it into a JOIN of the previous table and keeps parsing joins after it. Each table is parsed once, so nested derived tables stay linear. Tests cover SELECT and UPDATE ... FROM forms in SQLite and the generic dialect, and the exact error in every other dialect.

@LucaCappelletti94 LucaCappelletti94 added enhancement New feature or request SQLite labels Oct 17, 2026
@codecov-commenter

codecov-commenter commented Oct 17, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.33%. Comparing base (ada8314) to head (2b781e4).
⚠️ Report is 5 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2667      +/-   ##
==========================================
+ Coverage   81.28%   81.33%   +0.05%     
==========================================
  Files          42       42              
  Lines       33920    34009      +89     
  Branches    33920    34009      +89     
==========================================
+ Hits        27571    27661      +90     
+ Misses       2785     2784       -1     
  Partials     3564     3564              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@LucaCappelletti94
LucaCappelletti94 force-pushed the sqlite-comma-join-constraints branch from 29d64ae to e1b84a7 Compare October 18, 2026 14:21
@alamb
alamb added this pull request to the merge queue Oct 20, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Oct 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request SQLite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants