Commit af810407 authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-28098 incorrect key in "dup value" error after long unique

reset errkey after using it, so that it wouldn't affect
the next error message in the next statement
parent 0e4bc67e
......@@ -302,4 +302,18 @@ c
1
DELETE FROM t;
DROP TABLE t;
#
# MDEV-28098 incorrect key in "dup value" error after long unique
#
create table t1 (v3 int primary key, v2 text(100) unique not null, v1 int unique) engine=innodb;
insert into t1 values ( -32768 , -128 , 58 ) , ( -1 , 44 , -128 );
create table t2 (v6 int primary key, v5 text, a int not null) engine=innodb;
insert into t2 values ( 50 , 61 , -1 ) , ( -2147483648 , -128 , 0 );
update t1 set v2 = 1, v3 = -128;
ERROR 23000: Duplicate entry '1' for key 'v2'
update t1,t2 set v1 = v2 , v5 = 0;
ERROR 23000: Duplicate entry '-128' for key 'v1'
drop table t1, t2;
#
# End of 10.4 tests
#
......@@ -233,7 +233,6 @@ DROP TABLE t1;
#
# MDEV-18901 Wrong results after ADD UNIQUE INDEX(blob_column)
#
--source include/have_innodb.inc
CREATE TABLE t1 (data VARCHAR(7961)) ENGINE=InnoDB;
INSERT INTO t1 VALUES ('f'), ('o'), ('o');
......@@ -279,7 +278,6 @@ DROP TABLE t1;
# MDEV-18820 Assertion `lock_table_has(trx, index->table, LOCK_IX)' failed in lock_rec_insert_check_and_lock upon INSERT into table with blob key'
#
--source include/have_innodb.inc
set innodb_lock_wait_timeout= 10;
CREATE TABLE t1 (
......@@ -385,4 +383,19 @@ DELETE FROM t;
DROP TABLE t;
--echo #
--echo # MDEV-28098 incorrect key in "dup value" error after long unique
--echo #
create table t1 (v3 int primary key, v2 text(100) unique not null, v1 int unique) engine=innodb;
insert into t1 values ( -32768 , -128 , 58 ) , ( -1 , 44 , -128 );
create table t2 (v6 int primary key, v5 text, a int not null) engine=innodb;
insert into t2 values ( 50 , 61 , -1 ) , ( -2147483648 , -128 , 0 );
--error ER_DUP_ENTRY
update t1 set v2 = 1, v3 = -128;
--error ER_DUP_ENTRY
update t1,t2 set v1 = v2 , v5 = 0;
drop table t1, t2;
--echo #
--echo # End of 10.4 tests
--echo #
......@@ -3834,6 +3834,7 @@ void handler::print_error(int error, myf errflag)
if ((int) key_nr >= 0 && key_nr < table->s->keys)
{
print_keydup_error(table, &table->key_info[key_nr], errflag);
table->file->errkey= -1;
DBUG_VOID_RETURN;
}
}
......
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