mariadb/mysql-test/suite/innodb/t/change_column_collation.test
Marko Mäkelä 9a0cbd31ce MDEV-26294 Duplicate entries in unique index not detected when changing collation
ha_innobase::check_if_supported_inplace_alter(): Refuse to change the
collation of a column that would become or remain indexed as part of
the ALTER TABLE operation.

In MariaDB Server 10.6, we will allow this type of operation;
that fix depends on MDEV-15250.
2022-07-04 08:04:44 +03:00

24 lines
733 B
Text

--source include/have_innodb.inc
--echo #
--echo # MDEV-26294 Duplicate entries in unique index not detected when
--echo # changing collation with INPLACE algorithm
--echo #
# Detect the duplicate entry after collation change of column
SET NAMES utf8;
CREATE TABLE t1 (
id INT PRIMARY KEY,
msg VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_swedish_ci UNIQUE
) ENGINE=INNODB;
INSERT INTO t1 VALUES (1, 'aaa');
INSERT INTO t1 VALUES (2, 'ååå');
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
ALTER TABLE t1
MODIFY msg VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_unicode_ci,
ALGORITHM=NOCOPY;
ALTER TABLE t1 DROP INDEX msg,
MODIFY msg VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_unicode_ci,
ALGORITHM=NOCOPY;
DROP TABLE t1;