mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Bug #49838: DROP INDEX and ADD UNIQUE INDEX for same index may corrupt
definition at engine If a single ALTER TABLE contains both DROP INDEX and ADD INDEX using the same index name (a.k.a. index modification) we need to disable in-place alter table because we can't ask the storage engine to have two copies of the index with the same name even temporarily (if we first do the ADD INDEX and then DROP INDEX) and we can't modify indexes that are needed by e.g. foreign keys if we first do DROP INDEX and then ADD INDEX. Fixed the problem by disabling in-place ALTER TABLE for these cases.
This commit is contained in:
@ -2317,4 +2317,37 @@ ref NULL
|
||||
rows 10
|
||||
Extra Using index
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug #49838: DROP INDEX and ADD UNIQUE INDEX for same index may
|
||||
# corrupt definition at engine
|
||||
#
|
||||
CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL, KEY k (a,b))
|
||||
ENGINE=InnoDB;
|
||||
ALTER TABLE t1 DROP INDEX k, ADD UNIQUE INDEX k (a,b);
|
||||
SHOW INDEXES FROM t1;;
|
||||
Table t1
|
||||
Non_unique 0
|
||||
Key_name k
|
||||
Seq_in_index 1
|
||||
Column_name a
|
||||
Collation A
|
||||
Cardinality 0
|
||||
Sub_part NULL
|
||||
Packed NULL
|
||||
Null
|
||||
Index_type BTREE
|
||||
Comment
|
||||
Table t1
|
||||
Non_unique 0
|
||||
Key_name k
|
||||
Seq_in_index 2
|
||||
Column_name b
|
||||
Collation A
|
||||
Cardinality 0
|
||||
Sub_part NULL
|
||||
Packed NULL
|
||||
Null
|
||||
Index_type BTREE
|
||||
Comment
|
||||
DROP TABLE t1;
|
||||
End of 5.1 tests
|
||||
|
Reference in New Issue
Block a user