Skip to content

Feat(mysql): support ALTER TABLE ... RENAME INDEX.#7511

Merged
georgesittas merged 3 commits intotobymao:mainfrom
burnison:rename_index_mysql
Apr 17, 2026
Merged

Feat(mysql): support ALTER TABLE ... RENAME INDEX.#7511
georgesittas merged 3 commits intotobymao:mainfrom
burnison:rename_index_mysql

Conversation

@burnison
Copy link
Copy Markdown
Contributor

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.

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.
Comment thread tests/dialects/test_mysql.py Outdated
this = self.sql(expression, "this")
to = self.sql(expression, "to")
return f"RENAME INDEX {this} TO {to}"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 georgesittas merged commit 30c6a54 into tobymao:main Apr 17, 2026
8 checks passed
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>
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.

3 participants