Commit b1034099 authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-18748 REPLACE doesn't work with unique blobs on MyISAM table

on long unique conflict, set table->file->dup_ref for
engines that support it
parent 9fd3e810
...@@ -53,3 +53,7 @@ create temporary table t1 (f blob, unique(f)) engine=innodb; ...@@ -53,3 +53,7 @@ create temporary table t1 (f blob, unique(f)) engine=innodb;
insert into t1 values (1); insert into t1 values (1);
replace into t1 values (1); replace into t1 values (1);
drop table t1; drop table t1;
create table t (b blob, unique(b)) engine=myisam;
insert into t values ('foo');
replace into t values ('foo');
drop table t;
...@@ -64,3 +64,11 @@ create temporary table t1 (f blob, unique(f)) engine=innodb; ...@@ -64,3 +64,11 @@ create temporary table t1 (f blob, unique(f)) engine=innodb;
insert into t1 values (1); insert into t1 values (1);
replace into t1 values (1); replace into t1 values (1);
drop table t1; drop table t1;
#
# MDEV-18748 REPLACE doesn't work with unique blobs on MyISAM table
#
create table t (b blob, unique(b)) engine=myisam;
insert into t values ('foo');
replace into t values ('foo');
drop table t;
...@@ -6558,7 +6558,14 @@ static int check_duplicate_long_entry_key(TABLE *table, handler *h, ...@@ -6558,7 +6558,14 @@ static int check_duplicate_long_entry_key(TABLE *table, handler *h,
error= HA_ERR_LOCK_WAIT_TIMEOUT; error= HA_ERR_LOCK_WAIT_TIMEOUT;
exit: exit:
if (error) if (error)
{
table->file->errkey= key_no; table->file->errkey= key_no;
if (h->ha_table_flags() & HA_DUPLICATE_POS)
{
h->position(table->check_unique_buf);
memcpy(table->file->dup_ref, h->ref, h->ref_length);
}
}
h->ha_index_end(); h->ha_index_end();
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