Details
Description
create table x (id int auto_increment primary key, name varchar(2048) collate utf8_general_ci, unique key u(name)); |
insert into x values (1,'test'); |
update x set name = "Test" where id=1 |
|
Duplicate entry 'Test' for key 'u |
A smaller varchar length ~200 will not generate an error.
Suspected MDEV-371 regression.
source: https://www.reddit.com/r/mariadb/comments/wu83pe/change_case_with_unique_constraint/
Attachments
Issue Links
- is caused by
-
MDEV-371 Unique indexes for blobs
- Closed
- is duplicated by
-
MDEV-34052 long uniques false positive when a row value changes letter case
- Closed
- relates to
-
MDEV-27653 long uniques don't work with unicode collations
- Closed
- links to
Here is a little simpler test case, not involving InnoDB at all:
I disabled
MDEV-371with the following:diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 6e8a4795f21..f8f3eefc114 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -2441,6 +2441,8 @@ static inline void make_long_hash_field_name(LEX_CSTRING *buf, uint num)
static Create_field * add_hash_field(THD * thd, List<Create_field> *create_list,
KEY *key_info)
{
+ my_error(ER_TOO_LONG_KEY, MYF(0), 1000);
+ return nullptr;
List_iterator<Create_field> it(*create_list);
Create_field *dup_field, *cf= new (thd->mem_root) Create_field();
With
MDEV-371disabled, the error ER_TOO_LONG_KEY would be output for anything longer than varchar(333). For shorter values, no duplicate key error will be flagged.