mirror of
https://github.com/MariaDB/server.git
synced 2025-01-30 18:41:56 +01:00
f8240a2723
Problem: ======= ALTER TABLE in InnoDB fails to detect duplicate entries for the unique index when the character set or collation of an indexed column is changed in such a way that the character encoding is compatible with the old table definition. In this case, any secondary indexes on the changed columns would be rebuilt (DROP INDEX, ADD INDEX). Solution: ======== During ALTER TABLE, InnoDB keeps track of columns whose collation changed, and will fill in the correct metadata when sorting the index records, or applying changes from concurrent DML. This metadata will be allocated in the dict_index_t::heap of the being-created secondary indexes. The fix was developed by Thirunarayanan Balathandayuthapani and simplified by me.
58 lines
3.1 KiB
Text
58 lines
3.1 KiB
Text
@@ -279,7 +279,6 @@
|
|
alter table boundary_255
|
|
modify a varchar(70) charset utf8mb4,
|
|
algorithm=instant;
|
|
-ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
|
|
drop table boundary_255;
|
|
create table t (
|
|
a char(10) collate utf8mb3_general_ci,
|
|
@@ -297,32 +296,21 @@
|
|
repeat('a', 10), repeat('a', 10)
|
|
);
|
|
alter table t modify a char(10) collate utf8mb4_general_ci, algorithm=instant;
|
|
-check table t;
|
|
-Table Op Msg_type Msg_text
|
|
-test.t check status OK
|
|
+ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
|
|
alter table t modify b char(70) collate utf8mb4_general_ci, algorithm=instant;
|
|
-check table t;
|
|
-Table Op Msg_type Msg_text
|
|
-test.t check status OK
|
|
+ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
|
|
alter table t modify c char(100) collate utf8mb4_general_ci, algorithm=instant;
|
|
-check table t;
|
|
-Table Op Msg_type Msg_text
|
|
-test.t check status OK
|
|
+ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
|
|
alter table t modify aa char(10) collate utf8mb4_general_ci, algorithm=instant;
|
|
-check table t;
|
|
-Table Op Msg_type Msg_text
|
|
-test.t check status OK
|
|
+ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
|
|
alter table t modify bb char(70) collate utf8mb4_general_ci, algorithm=instant;
|
|
-check table t;
|
|
-Table Op Msg_type Msg_text
|
|
-test.t check status OK
|
|
+ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
|
|
alter table t modify cc char(100) collate utf8mb4_general_ci, algorithm=instant;
|
|
-check table t;
|
|
-Table Op Msg_type Msg_text
|
|
-test.t check status OK
|
|
+ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
|
|
alter table t modify d char(10) collate utf8mb4_spanish_ci, algorithm=instant;
|
|
+ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
|
|
alter table t modify dd char(10) collate utf8mb4_spanish_ci, algorithm=instant;
|
|
-ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: ADD INDEX. Try ALGORITHM=NOCOPY
|
|
+ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: Cannot change column type. Try ALGORITHM=COPY
|
|
select * from t;
|
|
a b c aa bb cc d dd
|
|
aaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaa aaaaaaaaaa
|
|
@@ -2066,7 +2054,7 @@
|
|
ALTER TABLE t1
|
|
CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci,
|
|
ADD UNIQUE INDEX test_key (a);
|
|
-ERROR 23000: Duplicate entry 'NULL' for key 'test_key'
|
|
+ERROR 23000: Duplicate entry 'a1' for key 'test_key'
|
|
ALTER TABLE t1 CONVERT TO CHARACTER SET UTF8MB4 COLLATE UTF8MB4_UNICODE_520_CI;
|
|
CHECK TABLE t1;
|
|
Table Op Msg_type Msg_text
|