Skip to content

fix: parse arithmetic after subqueries in BETWEEN bounds - #2946

Open
hutiefang76 wants to merge 1 commit into
JSQLParser:masterfrom
hutiefang76:frank/fix-between-subselect-bound-2944-20261119
Open

hutiefang76 wants to merge 1 commit into
JSQLParser:masterfrom
hutiefang76:frank/fix-between-subselect-bound-2944-20261119

Conversation

@hutiefang76

Copy link
Copy Markdown
Contributor

Fixes #2944.

A parenthesized subquery at the start of a BETWEEN bound previously stopped parsing at the closing parenthesis. Both bounds now continue through the existing arithmetic parser. The regression cases cover subtraction, an interval and addition, with checks on the resulting expression nodes.

  • ./gradlew --offline --no-daemon check passed, including all 14 BetweenTest cases and the JavaCC grammar ambiguity check.
  • mvn clean verify passed before the final test formatting change.
  • The existing JMH SQL corpus measured 13.74 ± 0.41 ms/op on the base and 14.03 ± 0.45 ms/op with this patch. The intervals overlap.

AI assistance: DeepSeek and OpenAI Codex assisted implementation and review. I ran the tests and benchmark locally.

Use the existing arithmetic continuation for parenthesized subqueries in both BETWEEN bounds. Check the reported expressions and their parsed node types.

Refs JSQLParser#2944

This branch has not been deployed

No deployments
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.

[BUG] JSQLParser 5.4 : PostgreSQL : BETWEEN bound starting with a parenthesized sub-select cannot be followed by an arithmetic operator

1 participant