Skip to content

Support nested parentheses around subqueries, CTEs, and derived tables - #489

Merged
elianddb merged 6 commits into
mainfrom
elian/8058
Sep 4, 2026
Merged

Support nested parentheses around subqueries, CTEs, and derived tables#489
elianddb merged 6 commits into
mainfrom
elian/8058

Conversation

@elianddb

@elianddb elianddb commented Sep 4, 2026

Copy link
Copy Markdown

@elianddb
elianddb requested a review from zachmu as a code owner September 4, 2026 18:06
@elianddb elianddb changed the title sqlparser: allow nested parentheses around subqueries Support nested parentheses around subqueries in derived tables and EXISTS Sep 4, 2026
Comment thread go/vt/sqlparser/ast.go Outdated

@zachmu zachmu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this implementation does way too much. This should be a relatively simple targeted rule change that just allows ( and ) to arbitrary levels. Instead it adds a bunch of new functions and rules with bad names. We don't need any of this validation, we just need to allow more sets of parens in certain places.

Comment thread go/vt/sqlparser/sql.y Outdated
@elianddb elianddb changed the title Support nested parentheses around subqueries in derived tables and EXISTS Support nested parentheses around subqueries, CTEs, and derived tables Sep 4, 2026

@zachmu zachmu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Much better, LGTM

Comment thread go/vt/sqlparser/parse_test.go Outdated
@elianddb
elianddb merged commit 1d51d13 into main Sep 4, 2026
4 checks passed
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.

EXISTS ((subquery)) fails to parse, while IN ((subquery)) and scalar ((subquery)) succeed Double parentheses ie. ((...)) do not parse in Dolt

2 participants