Skip to content

fix: keep set operations after a parenthesized FROM subquery at the outer query - #35

Merged
kvlonge merged 1 commit into
mainfrom
fix/set-operation-after-from-subquery
Oct 19, 2026
Merged

kvlonge merged 1 commit into
mainfrom
fix/set-operation-after-from-subquery

Conversation

@kvlonge

@kvlonge kvlonge commented Oct 19, 2026

Copy link
Copy Markdown

Why

Changes

Verification

  • Regression test across 7 dialects (parse tree and regenerated SQL) for the mis-parsed shape and the unchanged bracketed forms.
  • Parser lib tests pass (1350). Four other crate tests fail identically with and without this change.

…uter query

A parenthesized query in FROM absorbed a following UNION/INTERSECT/EXCEPT,
so `SELECT * FROM (SELECT ...) UNION ALL SELECT ...` parsed as
`SELECT * FROM ((SELECT ...) UNION ALL SELECT ...)`. A parenthesized FROM
query now continues into a set operation only where it opens an enclosing
parenthesis, as in `FROM ((SELECT 1) UNION (SELECT 2))`, matching the
expression-operand rule.

The wrapper-normalization test now starts from an explicitly wrapped set
operation, since the unwrapped query no longer parses as one.
@kvlonge
kvlonge merged commit b18dc64 into main Oct 19, 2026
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