pingcap / pingcap/tidb

Multischema change rename index fail

Open
#65,458 0 comments 0 reactions 1 assignee Claimed by @fzzf678 View on GitHub
compatibility-mysql8 component/ddl severity/moderate type/bug
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## 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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.