Details
-
Type:
Bug
-
Status: Closed (View Workflow)
-
Priority:
Critical
-
Resolution: Fixed
-
Affects Version/s: 10.4, 10.5, 10.6
-
Component/s: Data types
-
Labels:None
Description
set names utf8; |
create table t1 (a text collate utf8_general_ci unique); |
show create table t1; |
insert t1 values ('a'); |
insert t1 values ('ä'); |
select * from t1; |
select distinct * from t1; |
select 'a' = 'ä'; |
drop table t1; |
shows that one can insert two characters into a long unique index that compare equally.
It happens because calc_hash_for_unique() hashes string length in bytes together with the string content. So even if two utf8 strings hash to the same value, they can have different length in bytes and long unique hash will be different.
Attachments
Issue Links
- blocks
-
MDEV-29954 Unique hash key on column prefix is computed incorrectly
-
- Stalled
-
- relates to
-
MDEV-371 Unique indexes for blobs
-
- Closed
-
-
MDEV-28190 sql_mode makes MDEV-371 virtual column expressions nondeterministic
-
- Stalled
-
-
MDEV-29345 update case insensitive (large) unique key with insensitive change of value - duplicate key
-
- Confirmed
-