Skip to content

fix(parser): distinguish MySQL constraint and index names - #2534

Merged
manticore-projects merged 2 commits into
JSQLParser:masterfrom
minleejae:fix/mysql-constraint-index-name-1570
Sep 4, 2026
Merged

fix(parser): distinguish MySQL constraint and index names#2534
manticore-projects merged 2 commits into
JSQLParser:masterfrom
minleejae:fix/mysql-constraint-index-name-1570

Conversation

@minleejae

Copy link
Copy Markdown
Contributor

Summary

  • distinguish the optional MySQL CONSTRAINT symbol from the optional index name
  • support CONSTRAINT without a symbol and named UNIQUE or FOREIGN KEY indexes
  • preserve getName() for the constraint symbol and expose the index name through getIndexName()
  • retain USING and index comments during deparsing

These cases share the same constraint/index-name ambiguity and are implemented together.

Testing

  • ./gradlew check

Fixes #1570
Fixes #538

AI assistance

OpenAI Codex assisted with the implementation and test coverage. The changes were manually reviewed and verified.

@manticore-projects

Copy link
Copy Markdown
Contributor

Please resolve conflicts from overlapping PRs.

@minleejae

Copy link
Copy Markdown
Contributor Author

@manticore-projects Conflicts have been resolved, and all CI checks are passing.

@manticore-projects
manticore-projects merged commit bc9ca85 into JSQLParser:master Sep 4, 2026
7 checks passed
@manticore-projects

Copy link
Copy Markdown
Contributor

Thank you much!

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.

MySQL (optional) Index Names Format create table sql error when encounter unique key with comment

2 participants