Skip to content

Multischema change rename index fail #65458

@fzzf678

Description

@fzzf678

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

MySQL:

mysql> create table t(id int, index i1(id), index i2(id));
Query OK, 0 rows affected, 1 warning (0.01 sec)

mysql> alter table t rename index i1 to i,rename index i2 to i1;
Query OK, 0 rows affected (0.01 sec)
Records: 0  Duplicates: 0  Warnings: 0

mysql> select version();
+-----------+
| version() |
+-----------+
| 8.0.31    |
+-----------+
1 row in set (0.00 sec)

TiDB:

mysql> create table t(id int, index i1(id), index i2(id));
Query OK, 0 rows affected (0.04 sec)

mysql> alter table t rename index i1 to i,rename index i2 to i1;
ERROR 1061 (42000): Duplicate key name 'i1'

mysql> select tidb_version();
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| tidb_version()                                                                                                                                                                                                                                                                                |
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Release Version: v9.0.0-beta.2.pre-707-g968e31fc3f
Edition: Community
Git Commit Hash: 968e31fc3fef850f4312edd17d262a545aeb7d68
Git Branch: HEAD
UTC Build Time: 2025-10-31 01:56:33
GoVersion: go1.23.12
Race Enabled: false
Check Table Before Drop: false
Store: tikv
Kernel Type: Classic |
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.01 sec)

2. What did you expect to see? (Required)

DDL can succeed in TiDB

3. What did you see instead (Required)

It fails

4. What is your TiDB version? (Required)

master

Metadata

Metadata

Assignees

No one assigned

    Labels

    compatibility-mysql8This is a compatibility issue with MySQL 8.0(but NOT 5.7)component/ddlThis issue is related to DDL of TiDB.severity/moderatetype/bugThe issue is confirmed as a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions