Feat(mysql): support ALTER TABLE ... RENAME INDEX.#7511
Merged
georgesittas merged 3 commits intotobymao:mainfrom Apr 17, 2026
Merged
Feat(mysql): support ALTER TABLE ... RENAME INDEX.#7511georgesittas merged 3 commits intotobymao:mainfrom
ALTER TABLE ... RENAME INDEX.#7511georgesittas merged 3 commits intotobymao:mainfrom
Conversation
MySQL 5.7 introduced `ALTER TABLE ... RENAME INDEX old TO new` (and the `RENAME KEY` synonym) as a metadata-only operation that renames an index without rebuilding it.
VaggelisD
reviewed
Apr 17, 2026
VaggelisD
approved these changes
Apr 17, 2026
VaggelisD
approved these changes
Apr 17, 2026
VaggelisD
reviewed
Apr 17, 2026
| this = self.sql(expression, "this") | ||
| to = self.sql(expression, "to") | ||
| return f"RENAME INDEX {this} TO {to}" | ||
|
|
Collaborator
There was a problem hiding this comment.
Missed this before, given that we introduced this node should move this to generator.py, otherwise MySQL -> Other would error out with "Generator missing exp.RenameIndex.
We can also move the parsing to the base parser if we want to avoid overriding MySQL, up to you.
georgesittas
pushed a commit
that referenced
this pull request
Apr 17, 2026
* Feat(mysql): support `ALTER TABLE ... RENAME INDEX`. MySQL 5.7 introduced `ALTER TABLE ... RENAME INDEX old TO new` (and the `RENAME KEY` synonym) as a metadata-only operation that renames an index without rebuilding it. * Update tests/dialects/test_mysql.py --------- Co-authored-by: Vaggelis Danias <daniasevangelos@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
MySQL 5.7 introduced
ALTER TABLE ... RENAME INDEX old TO new(and theRENAME KEYsynonym) as a metadata-only operation that renames an index without rebuilding it.