Skip to content

rename index forgot to rename the virtual generated column #51431

@lance6716

Description

@lance6716

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

mysql> create table t(j json);
Query OK, 0 rows affected (0.78 sec)

mysql> alter table t add index idx1((cast(j as char(10) array)));
Query OK, 0 rows affected (3.24 sec)

mysql> alter table t rename index idx1 to idx2;
Query OK, 0 rows affected (0.73 sec)

mysql> alter table t add index idx1((cast(j as char(10) array)));
ERROR 1060 (42S21): Duplicate column name '_V$_idx1_0'

mysql> show create table t;
+-------+------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table                                                                                                                                         |
+-------+------------------------------------------------------------------------------------------------------------------------------------------------------+
| t     | CREATE TABLE `t` (
  `j` json DEFAULT NULL,
  KEY `idx2` ((cast(`j` as char(10) array)))
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin |
+-------+------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.20 sec)

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

3. What did you see instead (Required)

4. What is your TiDB version? (Required)

Metadata

Metadata

Assignees

Labels

affects-5.4This bug affects the 5.4.x(LTS) versions.affects-6.1This bug affects the 6.1.x(LTS) versions.affects-6.5This bug affects the 6.5.x(LTS) versions.affects-7.1This bug affects the 7.1.x(LTS) versions.affects-7.5This bug affects the 7.5.x(LTS) versions.affects-7.6component/ddlThis issue is related to DDL of TiDB.severity/majortype/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