Skip to content

Do not treat parentheses as special characters when parsing inner query#5

Merged
florianschieder merged 4 commits intomainfrom
nesting-correction-station
Apr 10, 2026
Merged

Do not treat parentheses as special characters when parsing inner query#5
florianschieder merged 4 commits intomainfrom
nesting-correction-station

Conversation

@florianschieder
Copy link
Copy Markdown
Contributor

@florianschieder florianschieder commented Apr 10, 2026

sqlquerypp issues a parser state transition when it sees ( and ).

This is correct behavior, but NOT when we are within the { ... } scope, because within that scope ( and ) are evaluated in MySQL, not sqlquerypp. Otherwise, sqlquerypp tries to unroll the state back to the combinator expression and the confusion is confused.

This led to errors when extending a sqlquerypp-preprocessed query which previously contained AND something = 'foo' to AND something IN ('bar', 'foo').

The fix is quite simple: introducing a new state variable and skipping the TokenState::OpeningParenthese transition in case we are already within the { ... } scope which contains the SQL query to combine.

@florianschieder florianschieder force-pushed the nesting-correction-station branch from 468d373 to 2ce8648 Compare April 10, 2026 07:12
@florianschieder florianschieder requested a review from wfehr April 10, 2026 07:16
@florianschieder florianschieder merged commit 243eb5b into main Apr 10, 2026
1 check passed
@florianschieder florianschieder deleted the nesting-correction-station branch April 10, 2026 07:20
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.

2 participants