Commit 947eeaa6 authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-29345 update case insensitive (large) unique key with insensitive change...

MDEV-29345 update case insensitive (large) unique key with insensitive change of value - duplicate key

use collation-sensitive comparison when comparing fields
parent 91fb8b7f
...@@ -694,5 +694,27 @@ Hrecvx_0004ln-00 1 ...@@ -694,5 +694,27 @@ Hrecvx_0004ln-00 1
Hrecvx_0004mm-00 2 Hrecvx_0004mm-00 2
drop table t; drop table t;
# #
# End of 10.5 tests # MDEV-29345 update case insensitive (large) unique key with insensitive change of value - duplicate key
# #
create table t1 (a int, b text, unique (b));
insert ignore t1 values (1, 'a'), (2, 'A');
Warnings:
Warning 1062 Duplicate entry 'A' for key 'b'
select * from t1;
a b
1 a
update t1 set b='A' where a=1;
select * from t1;
a b
1 A
drop table t1;
create table t1 (a int, b blob, unique (b));
insert t1 values (1, 'a'), (2, 'A');
select * from t1;
a b
1 a
2 A
update t1 set b='A' where a=1;
ERROR 23000: Duplicate entry 'A' for key 'b'
drop table t1;
# End of 10.5 tests
...@@ -671,5 +671,20 @@ insert into t values ('Hrecvx_0004mm-00',2) ...@@ -671,5 +671,20 @@ insert into t values ('Hrecvx_0004mm-00',2)
select * from t; select * from t;
drop table t; drop table t;
--echo # --echo #
--echo # End of 10.5 tests --echo # MDEV-29345 update case insensitive (large) unique key with insensitive change of value - duplicate key
--echo # --echo #
create table t1 (a int, b text, unique (b));
insert ignore t1 values (1, 'a'), (2, 'A');
select * from t1;
update t1 set b='A' where a=1;
select * from t1;
drop table t1;
create table t1 (a int, b blob, unique (b));
insert t1 values (1, 'a'), (2, 'A');
select * from t1;
--error ER_DUP_ENTRY
update t1 set b='A' where a=1;
drop table t1;
--echo # End of 10.5 tests
...@@ -7082,7 +7082,7 @@ int handler::check_duplicate_long_entries_update(const uchar *new_rec) ...@@ -7082,7 +7082,7 @@ int handler::check_duplicate_long_entries_update(const uchar *new_rec)
So also check for that too So also check for that too
*/ */
if((field->is_null(0) != field->is_null(reclength)) || if((field->is_null(0) != field->is_null(reclength)) ||
field->cmp_binary_offset(reclength)) field->cmp_offset(reclength))
{ {
if((error= check_duplicate_long_entry_key(new_rec, i))) if((error= check_duplicate_long_entry_key(new_rec, i)))
return error; return error;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment