Skip to content

Split PostgreSQL hash operators from adjacent identifiers - #2588

Merged
manticore-projects merged 1 commit into
JSQLParser:masterfrom
minleejae:fix/postgres-json-operator-boundaries
Sep 11, 2026
Merged

Split PostgreSQL hash operators from adjacent identifiers#2588
manticore-projects merged 1 commit into
JSQLParser:masterfrom
minleejae:fix/postgres-json-operator-boundaries

Conversation

@minleejae

Copy link
Copy Markdown
Contributor

With Dialect.POSTGRESQL, js#>>'{a,b,1}' <> 'bar' now has the same JSON-expression AST and precedence as the spaced form. Split unquoted identifiers at #, then let the existing lexer recognize #>, #>> or the standalone hash operator. Quoted identifiers and literal bodies retain their contents; default/SQL Server names and MySQL hash comments retain their behavior.

Share identifier truncation with hash-comment handling and update token end positions after rewinding. Regression tests cover spacing variants, qualified/quoted names, chained JSON operators, token offsets, statement boundaries and dialect isolation. Full Gradle check and Maven verify passed, using upstream base eddb1fb5 for the local formatter ratchet.

Fixes #2163 (the remaining unspaced variant described in the comments; the original spaced query already works).

Reference: PostgreSQL identifier and operator rules.

@minleejae
minleejae force-pushed the fix/postgres-json-operator-boundaries branch from d6f0064 to 7e61585 Compare September 11, 2026 15:49
@minleejae
minleejae force-pushed the fix/postgres-json-operator-boundaries branch from 7e61585 to debad69 Compare September 11, 2026 15:54
@manticore-projects
manticore-projects merged commit a946e77 into JSQLParser:master Sep 11, 2026
8 checks passed
@manticore-projects

Copy link
Copy Markdown
Contributor

Thank you much!

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 Version : 5.1 RDBMS : PostgreSQL 10 mix the JSON and relational operators, it outputs the wrong AST and sql.

2 participants