1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

MDEV-22218 InnoDB: Failing assertion: node->pcur->rel_pos == BTR_PCUR_ON upon LOAD DATA with NO_BACKSLASH_ESCAPES in SQL_MODE and unique blob in table

`inited == NONE` at the initialization time does not always mean
that it'll be `NONE` later, at the execution time. Use a more complex
caller-specific logic to decide whether to create a cloned lookup handler.

Besides LOAD (as in the original bug report) make sure that all
prepare_for_insert() invocations are covered by tests. Add tests for
CREATE ... SELECT, multi-UPDATE, and multi-DELETE.

Don't enable write cache with long uniques.
This commit is contained in:
Sergei Golubchik
2020-04-12 18:09:09 +02:00
parent 8c0b988073
commit fcd84da5f1
11 changed files with 133 additions and 19 deletions

View File

@ -279,3 +279,61 @@ start transaction;
alter table tmp alter column a set default 8;
unlock tables;
drop table t2;
create table t1 (pk int primary key, f blob, unique(f)) engine=innodb;
insert t1 values (1, null);
select * into outfile 't1.data' from t1;
load data infile 't1.data' replace into table t1;
select * from t1;
pk f
1 NULL
drop table t1;
create table t1 (a int, b blob) engine=myisam;
insert t1 values (1,'foo'),(2,'bar'), (3, 'bar');
create table t2 (c int, d blob, unique(d)) engine=myisam;
insert t2 select * from t1;
ERROR 23000: Duplicate entry 'bar' for key 'd'
select * from t2;
c d
1 foo
2 bar
insert ignore t2 select * from t1;
Warnings:
Warning 1062 Duplicate entry 'foo' for key 'd'
Warning 1062 Duplicate entry 'bar' for key 'd'
Warning 1062 Duplicate entry 'bar' for key 'd'
select * from t2;
c d
1 foo
2 bar
replace t2 select * from t1;
select * from t2;
c d
1 foo
3 bar
update t1, t2 set t2.d='off' where t1.a=t2.c and t1.b='foo';
select * from t2;
c d
1 off
3 bar
alter table t2 add system versioning;
delete from t2 using t1, t2 where t1.a=t2.c and t1.b='foo';
select * from t2;
c d
3 bar
create or replace table t2 (a int, b blob, unique(b)) as select * from t1;
ERROR 23000: Duplicate entry 'bar' for key 'b'
select * from t2;
ERROR 42S02: Table 'test.t2' doesn't exist
create or replace table t2 (a int, b blob, unique(b)) ignore as select * from t1;
Warnings:
Warning 1062 Duplicate entry 'bar' for key 'b'
select * from t2;
a b
1 foo
2 bar
create or replace table t2 (a int, b blob, unique(b)) replace as select * from t1;
select * from t2;
a b
1 foo
3 bar
drop table if exists t1, t2;