Skip to content

fix: support JSON_TABLE DEFAULT ON ERROR with shared response parsing - #2683

Open
minleejae wants to merge 1 commit into
JSQLParser:masterfrom
minleejae:fix/json-table-default-on-error
Open

minleejae wants to merge 1 commit into
JSQLParser:masterfrom
minleejae:fix/json-table-default-on-error

Conversation

@minleejae

@minleejae minleejae commented Sep 23, 2026

Copy link
Copy Markdown
Contributor

JSON_TABLE rejects n INT PATH '$.n' DEFAULT '9' ON ERROR, including otherwise valid CREATE TABLE AS queries. Parse column ON EMPTY and ON ERROR with one shared response production, adding DEFAULT to the error path.

The response production reuses the existing JSON_QUERY alternatives and adds DEFAULT expressions. This removes duplicate response parsing while retaining the generated parser's existing JsonTableOnEmptyBehavior entry point. Defaults remain typed expressions accessible through getOnErrorBehavior(), its expression setter, and ExpressionVisitorAdapter. Original clause order is retained, including the legacy ON ERROR-before-ON EMPTY spelling.

Validation: ./gradlew check passed (8,157 tests, 25 skipped). Regression tests cover nested columns, both clause orders, AST edits and visitor traversal, both renderers, reparsing, and existing non-default responses. Six reproductions were executed on MySQL 8.4.11 before and after rendering, with identical results. Existing Oracle parser tests also pass.

Reference: MySQL JSON_TABLE response clauses.

Combined validation with #2682, #2683, #2684, #2685 and #2686: all five changes merge without conflicts; the integrated ./gradlew check passes (8,190 tests, 25 skipped). All 254 MySQL 8.4.11 fixtures parse, render and reparse, and execute with results identical to the original SQL.

Signed-off-by: minleejae <mmj9808@gmail.com>

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.

1 participant