Skip to content

Honour operator precedence in SQLite REGEXP, MATCH and GLOB - #2419

Open
LucaCappelletti94 wants to merge 1 commit into
apache:mainfrom
LucaCappelletti94:sqlite-pattern-operator-precedence
Open

Honour operator precedence in SQLite REGEXP, MATCH and GLOB#2419
LucaCappelletti94 wants to merge 1 commit into
apache:mainfrom
LucaCappelletti94:sqlite-pattern-operator-precedence

Conversation

@LucaCappelletti94

Copy link
Copy Markdown
Contributor

SQLiteDialect::parse_infix parsed the right operand of REGEXP, MATCH, and GLOB with parse_expr, and previously lead to mutating the meaning of boolean operations constructed with it.

For instance, a REGEXP 'p' AND b = 1 parsed as a REGEXP ('p' AND b = 1) instead of (a REGEXP 'p') AND (b = 1).

The hook was ignoring the precedence its caller passed, so using it fixes all three. Nothing errored before, and Display adds no parentheses, so the wrong tree reprinted as the original text. That is why a text round trip never caught it and the new test asserts on the tree instead.

@LucaCappelletti94
LucaCappelletti94 marked this pull request as ready for review July 31, 2026 14:39
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