Details
-
Bug
-
Status: Closed (View Workflow)
-
Critical
-
Resolution: Fixed
-
10.6.0, 10.4.20, 10.5.11
Description
When creating a table with a case sensitive collation on a column with unique constraint, then trying to alter the collation to a case insensitive one, entries that only differ in case lead to a duplicate entry error, aborting the ALTER TABLE, when using the COPY algorithm, as expected:
CREATE TABLE t1 (
|
id INT PRIMARY KEY,
|
msg VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_bin,
|
UNIQUE(msg)
|
) ENGINE=INNODB;
|
|
INSERT INTO t1 VALUES (1, 'aaa');
|
INSERT INTO t1 VALUES (2, 'AAA');
|
|
ALTER TABLE t1 MODIFY msg VARCHAR(100) CHARACTER SET utf8 COLLATE utf8_unicode_ci, ALGORITHM=COPY;
|
This gives
ERROR 1062 (23000): Duplicate entry 'AAA' for key 'msg'
|
as expected.
When trying the same with ALGORITHM=INPLACE or NOCOPY it works without detecting that we now have a duplicate entry though, so the new table version may now contain data violating the UNIQUE constraint.
Attachments
Issue Links
- blocks
-
MDEV-22365 Assertion `!col->mbmaxlen || len >= col->mbminlen * (fixed_len / col->mbmaxlen)' failed in row_merge_buf_add
- Closed
- causes
-
MDEV-29425 Buffer overflow in dict_index_t::col_info::add()
- Closed
- is blocked by
-
MDEV-15250 UPSERT during ALTER-TABLE results in 'Duplicate entry' error for alter
- Closed
- is caused by
-
MDEV-17301 Change of COLLATE unnecessarily requires ALGORITHM=COPY
- Closed
- is duplicated by
-
MDEV-27209 Assertion `((cursor)->page_cur.rec) == ((next_page) + page_get_infimum_offset(next_page))' failed
- Closed
-
MDEV-27280 server crashes on CHECK TABLE after COLLATE change for utf8mb4
- Closed
- relates to
-
MDEV-15564 Avoid table rebuild in ALTER TABLE on collation or charset changes
- Closed
-
MDEV-18584 Avoid copying when altering CHAR column in InnoDB table
- Confirmed