Skip to content

feat: support MySQL JSON_TABLE column collations - #2686

Open
minleejae wants to merge 1 commit into
JSQLParser:masterfrom
minleejae:feat/json-table-column-collation
Open

minleejae wants to merge 1 commit into
JSQLParser:masterfrom
minleejae:feat/json-table-column-collation

Conversation

@minleejae

@minleejae minleejae commented Sep 23, 2026

Copy link
Copy Markdown
Contributor

MySQL JSON_TABLE accepts column definitions such as n VARCHAR(10) COLLATE utf8mb4_bin PATH '$.n', but the parser stops at COLLATE. Parse an optional collation after the column type when Dialect.MYSQL is selected.

Expose the collation through JsonTableValueColumnDefinition.getCollation()/setCollation(String), preserve quoting, and render it with the column. Users can inspect, replace, remove or construct a collation without editing SQL strings. Character-set information remains in the existing ColDataType.

Validation: ./gradlew check passed. Tests cover bare, backtick-quoted and string-quoted collation names, an explicit character set, nested columns, AST construction and edits, both renderers, reparsing and dialect boundaries. Six SELECT/CREATE TABLE AS reproductions were executed on MySQL 8.4.11 before and after rendering, with identical results.

Collated EXISTS columns also need the existing EXISTS output-order correction in #2682; the changes are kept in separate PRs and tested together.

Reference: MySQL JSON_TABLE typed columns.

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