Skip to content

PostgreSQL SQL/JSON Parser Support#2255

Open
LucaCappelletti94 wants to merge 3 commits intoapache:mainfrom
LucaCappelletti94:postgres-regression-10
Open

PostgreSQL SQL/JSON Parser Support#2255
LucaCappelletti94 wants to merge 3 commits intoapache:mainfrom
LucaCappelletti94:postgres-regression-10

Conversation

@LucaCappelletti94
Copy link
Contributor

This PR adds PostgreSQL SQL/JSON parsing coverage for JSON_EXISTS, JSON_VALUE, JSON_QUERY, and table-level JSON_TABLE ... ON ERROR, following the PostgreSQL SQL/JSON query-function and JSON_TABLE syntax documented in the official manuals (SQL/JSON query functions, JSON_TABLE). Implementation-wise, the parser now uses function-aware clause parsing (instead of globally accepting these clauses in all function calls), introduces explicit AST clause variants for PASSING, ON EMPTY/ON ERROR, wrapper/quote behavior, and FORMAT JSON, and extends TableFactor::JsonTable with an optional table-level error-handling field.

This keeps round-trip formatting deterministic, and avoids broad dialect side effects. I left IS JSON exprs outside of this PR for now.

If anybody's wondering where all of these PRs are coming from, I am running differential fuzzing against sqlparser vs postgres 18. It's a bit of a blood bath.

@LucaCappelletti94 LucaCappelletti94 marked this pull request as ready for review February 27, 2026 12:46
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