Skip to content

feat: model MySQL CREATE TABLE AS duplicate handling - #2690

Merged
manticore-projects merged 1 commit into
JSQLParser:masterfrom
minleejae:feat/mysql-ctas-duplicates
Sep 24, 2026
Merged

manticore-projects merged 1 commit into
JSQLParser:masterfrom
minleejae:feat/mysql-ctas-duplicates

Conversation

@minleejae

@minleejae minleejae commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Support MySQL CREATE TABLE ... IGNORE/REPLACE [AS] query with a typed duplicate-handling enum. Previously these modifiers were rejected or consumed as table-option tokens.

Centralize query-prefix detection so table and partition options stop before the modifier, and render it through the shared CREATE TABLE query path. Tests cover omitted AS, SELECT/TABLE/VALUES, CTEs, and parentheses.

Validation:

  • Full Gradle check passed (Java 17), including grammar ambiguity, unit tests, coverage, formatting, Checkstyle, PMD, and SpotBugs.
  • On MySQL 8.4.11, duplicate-key CTAS retained the first row with IGNORE and the last row with REPLACE; all three SQL renderings matched.
  • Added AST, mutation, and parse/deparse regression coverage.

Syntax reference: official documentation.

Additional version-boundary validation: the original, toString, and deparser SQL was executed on isolated MySQL 9.7.2 and 26.7.0 servers, including the focused behavioral cases. Reviewed the MySQL 9.7 and MySQL 26.7 grammar. Runtime version numbers above identify the tested binaries; this does not claim support for every statement in those DBMS versions.

Signed-off-by: minleejae <mmj9808@gmail.com>
@manticore-projects
manticore-projects merged commit 8a11fb0 into JSQLParser:master Sep 24, 2026
10 checks passed
@manticore-projects

Copy link
Copy Markdown
Contributor

Thank you!

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.

2 participants