1
0
mirror of https://github.com/MariaDB/server.git synced 2025-10-12 12:25:37 +03:00

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
This commit is contained in:
Sergei Golubchik
2019-02-27 23:32:02 +01:00
parent 9fd3e810e8
commit b10340998f
3 changed files with 19 additions and 0 deletions

View File

@@ -53,3 +53,7 @@ create temporary table t1 (f blob, unique(f)) engine=innodb;
insert into t1 values (1);
replace into t1 values (1);
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;

View File

@@ -64,3 +64,11 @@ create temporary table t1 (f blob, unique(f)) engine=innodb;
insert into t1 values (1);
replace into t1 values (1);
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;

View File

@@ -6558,7 +6558,14 @@ static int check_duplicate_long_entry_key(TABLE *table, handler *h,
error= HA_ERR_LOCK_WAIT_TIMEOUT;
exit:
if (error)
{
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();
return error;
}