Skip to content

fix: preserve qualified ALTER TABLE rename targets - #2659

Merged
manticore-projects merged 1 commit into
JSQLParser:masterfrom
minleejae:fix/mysql-qualified-table-rename
Sep 21, 2026
Merged

manticore-projects merged 1 commit into
JSQLParser:masterfrom
minleejae:fix/mysql-qualified-table-rename

Conversation

@minleejae

Copy link
Copy Markdown
Contributor

MySQL permits ALTER TABLE db1.t RENAME TO db2.t2, but the current target parser reads only one identifier. Reuse Table parsing for qualified destinations with TO, AS, or an omitted rename keyword, including quoted identifiers containing dots.

Store the destination as a Table and derive the legacy new-table-name accessor from it, so structured edits and legacy setters stay consistent. TableDefinitionTraversal now visits the destination. Tests cover cross-database targets, multiple ALTER actions, legacy API edits, column/index rename regressions, and incomplete names.

Syntax reference: MySQL 8.4 RENAME TABLE.

Validation:

  • Java 17 Gradle check: 7,822 XML-reported tests, 0 failures/errors, 25 skipped; formatting, grammar ambiguity, Checkstyle, PMD, and JMH compilation passed. Formatting was checked against upstream/master using a local Spotless ratchet override.
  • Actual MySQL 8.4.11 server: 10 accepted and 4 rejected SQL cases matched the expected behavior.
  • Executed both AST and StatementDeParser output for the accepted cases on the same server: 20 successful executions.

Signed-off-by: minleejae <mmj9808@gmail.com>
@manticore-projects
manticore-projects merged commit 834d958 into JSQLParser:master Sep 21, 2026
10 checks passed
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