Partition the test innodb.temp_table_savepoint

This commit is contained in:
Marko Mäkelä 2020-06-08 12:52:29 +03:00
parent 3be169093b
commit 996431fdac
2 changed files with 8 additions and 469 deletions

View file

@ -2,45 +2,6 @@ create procedure populate_tables()
begin
declare n int default 20;
declare inner_loop int default 100;
create temporary table t1(c1 int not null,
c2 int not null,
c3 char(255) not null,
c4 text(6000) not null,
c5 blob(6000) not null,
c6 varchar(2000) not null,
c7 varchar(2000) not null,
c8 datetime,
c9 decimal(6,3),
primary key (c1),
index (c3,c4(50),c5(50)),
index (c2))
engine=innodb row_format=redundant;
create temporary table t2(c1 int not null,
c2 int not null,
c3 char(255) not null,
c4 text(6000) not null,
c5 blob(6000) not null,
c6 varchar(2000) not null,
c7 varchar(2000) not null,
c8 datetime,
c9 decimal(6,3),
primary key (c1),
index (c3,c4(50),c5(50)),
index (c2))
engine=innodb row_format=compact;
create temporary table t4(c1 int not null,
c2 int not null,
c3 char(255) not null,
c4 text(6000) not null,
c5 blob(6000) not null,
c6 varchar(2000) not null,
c7 varchar(2000) not null,
c8 datetime,
c9 decimal(6,3),
primary key (c1),
index (c3,c4(50),c5(50)),
index (c2))
engine=innodb row_format=dynamic;
create temporary table t5(c1 int not null,
c2 int not null,
c3 char(255) not null,
@ -58,18 +19,6 @@ create temporary table t6 ( a int ) engine = innodb;
insert into t6 values (50),(100),(150),(190);
while (n > 0) do
start transaction;
insert into t1 values(n,n,repeat(concat(' tc3_',n),30),
repeat(concat(' tc4_',n),8),repeat(concat(' tc_',n),8),
repeat(concat(' tc6_',n),8),repeat(concat(' tc7_',n),8),
now(),(100.55+n));
insert into t2 values(n,n,repeat(concat(' tc3_',n),30),
repeat(concat(' tc4_',n),8),repeat(concat(' tc_',n),8),
repeat(concat(' tc6_',n),8),repeat(concat(' tc7_',n),8),
now(),(100.55+n));
insert ignore into t4 values(n,n,repeat(concat(' tc3_',n),30),
repeat(concat(' tc4_',n),800),repeat(concat(' tc_',n),800),
repeat(concat(' tc6_',n),800),repeat(concat(' tc7_',n),800),
now(),(100.55+n));
insert ignore into t5 values(n,n,repeat(concat(' tc3_',n),30),
repeat(concat(' tc4_',n),800),repeat(concat(' tc_',n),800),
repeat(concat(' tc6_',n),800),repeat(concat(' tc7_',n),800),
@ -77,73 +26,25 @@ now(),(100.55+n));
if (n > 10) then
commit;
else
delete from t1 where c1 > 10 ;
delete from t2 where c1 > 10 ;
delete from t4 where c1 > 10 ;
delete from t5 where c1 > 10 ;
rollback;
start transaction;
update t1 set c1 = c1 + 1000 where c1 > 10;
update t2 set c1 = c1 + 1000 where c1 > 10;
update t4 set c1 = c1 + 1000 where c1 > 10;
update t5 set c1 = c1 + 1000 where c1 > 10;
rollback;
end if;
start transaction;
insert into t1 values(n+inner_loop,n+inner_loop,repeat(concat(' tc3_',n+inner_loop),30),
repeat(concat(' tc4_',n+inner_loop),8),repeat(concat(' tc_',n+inner_loop),8),
repeat(concat(' tc6_',n+inner_loop),2),repeat(concat(' tc7_',n+inner_loop),2),
now(),(100.55+n+inner_loop));
insert into t2 values(n+inner_loop,n+inner_loop,repeat(concat(' tc3_',n+inner_loop),30),
repeat(concat(' tc4_',n+inner_loop),8),repeat(concat(' tc_',n+inner_loop),8),
repeat(concat(' tc6_',n+inner_loop),2),repeat(concat(' tc7_',n+inner_loop),2),
now(),(100.55+n+inner_loop));
insert ignore into t4 values(n+inner_loop,n+inner_loop,repeat(concat(' tc3_',n+inner_loop),30),
repeat(concat(' tc4_',n+inner_loop),800),repeat(concat(' tc_',n+inner_loop),800),
repeat(concat(' tc6_',n+inner_loop),245),repeat(concat(' tc7_',n+inner_loop),245),
now(),(100.55+n+inner_loop));
insert ignore into t5 values(n+inner_loop,n+inner_loop,repeat(concat(' tc3_',n+inner_loop),30),
repeat(concat(' tc4_',n+inner_loop),800),repeat(concat(' tc_',n+inner_loop),800),
repeat(concat(' tc6_',n+inner_loop),245),repeat(concat(' tc7_',n+inner_loop),245),
now(),(100.55+n+inner_loop));
delete from t1 where c1 between 100 and 110;
delete from t2 where c1 between 100 and 110;
delete from t4 where c1 between 100 and 110;
delete from t5 where c1 between 100 and 110;
update t1 set c1 = c1+1 where c1>110;
update t2 set c1 = c1+1 where c1>110;
update t4 set c1 = c1+1 where c1>110;
update t5 set c1 = c1+1 where c1>110;
savepoint a;
insert into t1 values(300+n+inner_loop,n+inner_loop,repeat(concat(' tc3_',n+inner_loop),30),
repeat(concat(' tc4_',n+inner_loop),8),repeat(concat(' tc_',n+inner_loop),8),
repeat(concat(' tc6_',n+inner_loop),2),repeat(concat(' tc7_',n+inner_loop),2),
now(),(100.55+n+inner_loop));
insert into t2 values(300+n+inner_loop,n+inner_loop,repeat(concat(' tc3_',n+inner_loop),30),
repeat(concat(' tc4_',n+inner_loop),8),repeat(concat(' tc_',n+inner_loop),8),
repeat(concat(' tc6_',n+inner_loop),2),repeat(concat(' tc7_',n+inner_loop),2),
now(),(100.55+n+inner_loop));
insert ignore into t4 values(300+n+inner_loop,n+inner_loop,repeat(concat(' tc3_',n+inner_loop),30),
repeat(concat(' tc4_',n+inner_loop),800),repeat(concat(' tc_',n+inner_loop),800),
repeat(concat(' tc6_',n+inner_loop),245),repeat(concat(' tc7_',n+inner_loop),245),
now(),(100.55+n+inner_loop));
insert ignore into t5 values(300+n+inner_loop,n+inner_loop,repeat(concat(' tc3_',n+inner_loop),30),
repeat(concat(' tc4_',n+inner_loop),800),repeat(concat(' tc_',n+inner_loop),800),
repeat(concat(' tc6_',n+inner_loop),245),repeat(concat(' tc7_',n+inner_loop),245),
now(),(100.55+n+inner_loop));
savepoint b;
insert into t1 values(400+n+inner_loop,n+inner_loop,repeat(concat(' tc3_',n+inner_loop),30),
repeat(concat(' tc4_',n+inner_loop),8),repeat(concat(' tc_',n+inner_loop),8),
repeat(concat(' tc6_',n+inner_loop),2),repeat(concat(' tc7_',n+inner_loop),2),
now(),(100.55+n+inner_loop));
insert into t2 values(400+n+inner_loop,n+inner_loop,repeat(concat(' tc3_',n+inner_loop),30),
repeat(concat(' tc4_',n+inner_loop),8),repeat(concat(' tc_',n+inner_loop),8),
repeat(concat(' tc6_',n+inner_loop),2),repeat(concat(' tc7_',n+inner_loop),2),
now(),(100.55+n+inner_loop));
insert into t4 values(400+n+inner_loop,n+inner_loop,repeat(concat(' tc3_',n+inner_loop),30),
repeat(concat(' tc4_',n+inner_loop),800),repeat(concat(' tc_',n+inner_loop),800),
repeat(concat(' tc6_',n+inner_loop),245),repeat(concat(' tc7_',n+inner_loop),245),
now(),(100.55+n+inner_loop));
insert into t5 values(400+n+inner_loop,n+inner_loop,repeat(concat(' tc3_',n+inner_loop),30),
repeat(concat(' tc4_',n+inner_loop),800),repeat(concat(' tc_',n+inner_loop),800),
repeat(concat(' tc6_',n+inner_loop),245),repeat(concat(' tc7_',n+inner_loop),245),
@ -162,84 +63,6 @@ call populate_tables();;
connect con2,localhost,root,,;
call populate_tables();;
connection con1;
select count(*) from t1;
count(*)
20
select count(*) from t2;
count(*)
20
select count(*) from t4;
count(*)
20
select count(*) from t5;
count(*)
20
select c1 from t1;
c1
11
12
13
14
15
16
17
18
19
20
122
124
126
128
130
132
134
136
138
140
select c1 from t2;
c1
11
12
13
14
15
16
17
18
19
20
122
124
126
128
130
132
134
136
138
140
select c1 from t4;
c1
11
12
13
14
15
16
17
18
19
20
122
124
126
128
130
132
134
136
138
140
select c1 from t5;
c1
11
@ -263,84 +86,6 @@ c1
138
140
connection con2;
select count(*) from t1;
count(*)
20
select count(*) from t2;
count(*)
20
select count(*) from t4;
count(*)
20
select count(*) from t5;
count(*)
20
select c1 from t1;
c1
11
12
13
14
15
16
17
18
19
20
122
124
126
128
130
132
134
136
138
140
select c1 from t2;
c1
11
12
13
14
15
16
17
18
19
20
122
124
126
128
130
132
134
136
138
140
select c1 from t4;
c1
11
12
13
14
15
16
17
18
19
20
122
124
126
128
130
132
134
136
138
140
select c1 from t5;
c1
11
@ -365,89 +110,32 @@ c1
140
connection con1;
set autocommit = 0;
insert into t1 values (20,1,'a','a','a','a','a',now(),100.55);
ERROR 23000: Duplicate entry '20' for key 'PRIMARY'
insert ignore into t1 values (20,1,'a','a','a','a','a',now(),100.55);
Warnings:
Warning 1062 Duplicate entry '20' for key 'PRIMARY'
insert into t2 values (20,1,'a','a','a','a','a',now(),100.55);
ERROR 23000: Duplicate entry '20' for key 'PRIMARY'
insert ignore into t2 values (20,1,'a','a','a','a','a',now(),100.55);
Warnings:
Warning 1062 Duplicate entry '20' for key 'PRIMARY'
insert into t4 values (20,1,'a','a','a','a','a',now(),100.55);
ERROR 23000: Duplicate entry '20' for key 'PRIMARY'
insert ignore into t4 values (20,1,'a','a','a','a','a',now(),100.55);
Warnings:
Warning 1062 Duplicate entry '20' for key 'PRIMARY'
insert into t5 values (20,1,'a','a','a','a','a',now(),100.55);
ERROR 23000: Duplicate entry '20' for key 'PRIMARY'
insert ignore into t5 values (20,1,'a','a','a','a','a',now(),100.55);
Warnings:
Warning 1062 Duplicate entry '20' for key 'PRIMARY'
insert into t1 values (1,1,'a','a','a','a','a',now(),100.55),
(20,1,'a','a','a','a','a',now(),100.55);
ERROR 23000: Duplicate entry '20' for key 'PRIMARY'
insert into t2 values (1,1,'a','a','a','a','a',now(),100.55),
(20,1,'a','a','a','a','a',now(),100.55);
ERROR 23000: Duplicate entry '20' for key 'PRIMARY'
insert into t4 values (1,1,'a','a','a','a','a',now(),100.55),
(20,1,'a','a','a','a','a',now(),100.55);
ERROR 23000: Duplicate entry '20' for key 'PRIMARY'
insert into t5 values (1,1,'a','a','a','a','a',now(),100.55),
(20,1,'a','a','a','a','a',now(),100.55);
ERROR 23000: Duplicate entry '20' for key 'PRIMARY'
set autocommit = 1;
select c1,c2 from t1 where c1 in (20,1);
c1 c2
20 20
select c1,c2 from t2 where c1 in (20,1);
c1 c2
20 20
select c1,c2 from t4 where c1 in (20,1);
c1 c2
20 20
select c1,c2 from t5 where c1 in (20,1);
c1 c2
20 20
replace into t1 values (20,1,'a','a','a','a','a',now(),100.55);
replace into t2 values (20,1,'a','a','a','a','a',now(),100.55);
replace into t4 values (20,1,'a','a','a','a','a',now(),100.55);
replace into t5 values (20,1,'a','a','a','a','a',now(),100.55);
select c1,c2,c3,c4,c5,c6,c7,c9 from t1 where c1 = 20;
c1 c2 c3 c4 c5 c6 c7 c9
20 1 a a a a a 100.550
select c1,c2,c3,c4,c5,c6,c7,c9 from t2 where c1 = 20;
c1 c2 c3 c4 c5 c6 c7 c9
20 1 a a a a a 100.550
select c1,c2,c3,c4,c5,c6,c7,c9 from t4 where c1 = 20;
c1 c2 c3 c4 c5 c6 c7 c9
20 1 a a a a a 100.550
select c1,c2,c3,c4,c5,c6,c7,c9 from t5 where c1 = 20;
c1 c2 c3 c4 c5 c6 c7 c9
20 1 a a a a a 100.550
update ignore t1 set c1 = 20 where c1 = 140 ;
update ignore t2 set c1 = 20 where c1 = 140 ;
update ignore t4 set c1 = 20 where c1 = 140 ;
update ignore t5 set c1 = 20 where c1 = 140 ;
select count(*) from t1 where c1 = 140;
count(*)
1
select count(*) from t2 where c1 = 140;
count(*)
1
select count(*) from t4 where c1 = 140;
count(*)
1
select count(*) from t5 where c1 = 140;
count(*)
1
select * into outfile "VARDIR/tmp/t1.outfile" from t1;
create temporary table temp_1 engine = innodb as select * from t1 where 1=2;
select * into outfile "VARDIR/tmp/t5.outfile" from t5;
create temporary table temp_1 engine = innodb as select * from t5 where 1=2;
select count(*) from temp_1;
count(*)
0
load data infile 'VARDIR/tmp/t1.outfile' into table temp_1;
load data infile 'VARDIR/tmp/t5.outfile' into table temp_1;
select count(*) from temp_1;
count(*)
20

View file

@ -1,5 +1,5 @@
--source include/have_innodb.inc
--source include/no_valgrind_without_big.inc
--source include/innodb_row_format.inc
####################################################################
# TC to test temp-table DML optimization changes for correctness #
@ -28,48 +28,6 @@ create procedure populate_tables()
declare n int default 20;
declare inner_loop int default 100;
create temporary table t1(c1 int not null,
c2 int not null,
c3 char(255) not null,
c4 text(6000) not null,
c5 blob(6000) not null,
c6 varchar(2000) not null,
c7 varchar(2000) not null,
c8 datetime,
c9 decimal(6,3),
primary key (c1),
index (c3,c4(50),c5(50)),
index (c2))
engine=innodb row_format=redundant;
create temporary table t2(c1 int not null,
c2 int not null,
c3 char(255) not null,
c4 text(6000) not null,
c5 blob(6000) not null,
c6 varchar(2000) not null,
c7 varchar(2000) not null,
c8 datetime,
c9 decimal(6,3),
primary key (c1),
index (c3,c4(50),c5(50)),
index (c2))
engine=innodb row_format=compact;
create temporary table t4(c1 int not null,
c2 int not null,
c3 char(255) not null,
c4 text(6000) not null,
c5 blob(6000) not null,
c6 varchar(2000) not null,
c7 varchar(2000) not null,
c8 datetime,
c9 decimal(6,3),
primary key (c1),
index (c3,c4(50),c5(50)),
index (c2))
engine=innodb row_format=dynamic;
create temporary table t5(c1 int not null,
c2 int not null,
c3 char(255) not null,
@ -89,18 +47,6 @@ create procedure populate_tables()
while (n > 0) do
start transaction;
insert into t1 values(n,n,repeat(concat(' tc3_',n),30),
repeat(concat(' tc4_',n),8),repeat(concat(' tc_',n),8),
repeat(concat(' tc6_',n),8),repeat(concat(' tc7_',n),8),
now(),(100.55+n));
insert into t2 values(n,n,repeat(concat(' tc3_',n),30),
repeat(concat(' tc4_',n),8),repeat(concat(' tc_',n),8),
repeat(concat(' tc6_',n),8),repeat(concat(' tc7_',n),8),
now(),(100.55+n));
insert ignore into t4 values(n,n,repeat(concat(' tc3_',n),30),
repeat(concat(' tc4_',n),800),repeat(concat(' tc_',n),800),
repeat(concat(' tc6_',n),800),repeat(concat(' tc7_',n),800),
now(),(100.55+n));
insert ignore into t5 values(n,n,repeat(concat(' tc3_',n),30),
repeat(concat(' tc4_',n),800),repeat(concat(' tc_',n),800),
repeat(concat(' tc6_',n),800),repeat(concat(' tc7_',n),800),
@ -109,80 +55,32 @@ create procedure populate_tables()
if (n > 10) then
commit;
else
delete from t1 where c1 > 10 ;
delete from t2 where c1 > 10 ;
delete from t4 where c1 > 10 ;
delete from t5 where c1 > 10 ;
rollback;
start transaction;
update t1 set c1 = c1 + 1000 where c1 > 10;
update t2 set c1 = c1 + 1000 where c1 > 10;
update t4 set c1 = c1 + 1000 where c1 > 10;
update t5 set c1 = c1 + 1000 where c1 > 10;
rollback;
end if;
start transaction;
insert into t1 values(n+inner_loop,n+inner_loop,repeat(concat(' tc3_',n+inner_loop),30),
repeat(concat(' tc4_',n+inner_loop),8),repeat(concat(' tc_',n+inner_loop),8),
repeat(concat(' tc6_',n+inner_loop),2),repeat(concat(' tc7_',n+inner_loop),2),
now(),(100.55+n+inner_loop));
insert into t2 values(n+inner_loop,n+inner_loop,repeat(concat(' tc3_',n+inner_loop),30),
repeat(concat(' tc4_',n+inner_loop),8),repeat(concat(' tc_',n+inner_loop),8),
repeat(concat(' tc6_',n+inner_loop),2),repeat(concat(' tc7_',n+inner_loop),2),
now(),(100.55+n+inner_loop));
insert ignore into t4 values(n+inner_loop,n+inner_loop,repeat(concat(' tc3_',n+inner_loop),30),
repeat(concat(' tc4_',n+inner_loop),800),repeat(concat(' tc_',n+inner_loop),800),
repeat(concat(' tc6_',n+inner_loop),245),repeat(concat(' tc7_',n+inner_loop),245),
now(),(100.55+n+inner_loop));
insert ignore into t5 values(n+inner_loop,n+inner_loop,repeat(concat(' tc3_',n+inner_loop),30),
repeat(concat(' tc4_',n+inner_loop),800),repeat(concat(' tc_',n+inner_loop),800),
repeat(concat(' tc6_',n+inner_loop),245),repeat(concat(' tc7_',n+inner_loop),245),
now(),(100.55+n+inner_loop));
delete from t1 where c1 between 100 and 110;
delete from t2 where c1 between 100 and 110;
delete from t4 where c1 between 100 and 110;
delete from t5 where c1 between 100 and 110;
update t1 set c1 = c1+1 where c1>110;
update t2 set c1 = c1+1 where c1>110;
update t4 set c1 = c1+1 where c1>110;
update t5 set c1 = c1+1 where c1>110;
savepoint a;
insert into t1 values(300+n+inner_loop,n+inner_loop,repeat(concat(' tc3_',n+inner_loop),30),
repeat(concat(' tc4_',n+inner_loop),8),repeat(concat(' tc_',n+inner_loop),8),
repeat(concat(' tc6_',n+inner_loop),2),repeat(concat(' tc7_',n+inner_loop),2),
now(),(100.55+n+inner_loop));
insert into t2 values(300+n+inner_loop,n+inner_loop,repeat(concat(' tc3_',n+inner_loop),30),
repeat(concat(' tc4_',n+inner_loop),8),repeat(concat(' tc_',n+inner_loop),8),
repeat(concat(' tc6_',n+inner_loop),2),repeat(concat(' tc7_',n+inner_loop),2),
now(),(100.55+n+inner_loop));
insert ignore into t4 values(300+n+inner_loop,n+inner_loop,repeat(concat(' tc3_',n+inner_loop),30),
repeat(concat(' tc4_',n+inner_loop),800),repeat(concat(' tc_',n+inner_loop),800),
repeat(concat(' tc6_',n+inner_loop),245),repeat(concat(' tc7_',n+inner_loop),245),
now(),(100.55+n+inner_loop));
insert ignore into t5 values(300+n+inner_loop,n+inner_loop,repeat(concat(' tc3_',n+inner_loop),30),
repeat(concat(' tc4_',n+inner_loop),800),repeat(concat(' tc_',n+inner_loop),800),
repeat(concat(' tc6_',n+inner_loop),245),repeat(concat(' tc7_',n+inner_loop),245),
now(),(100.55+n+inner_loop));
savepoint b;
insert into t1 values(400+n+inner_loop,n+inner_loop,repeat(concat(' tc3_',n+inner_loop),30),
repeat(concat(' tc4_',n+inner_loop),8),repeat(concat(' tc_',n+inner_loop),8),
repeat(concat(' tc6_',n+inner_loop),2),repeat(concat(' tc7_',n+inner_loop),2),
now(),(100.55+n+inner_loop));
insert into t2 values(400+n+inner_loop,n+inner_loop,repeat(concat(' tc3_',n+inner_loop),30),
repeat(concat(' tc4_',n+inner_loop),8),repeat(concat(' tc_',n+inner_loop),8),
repeat(concat(' tc6_',n+inner_loop),2),repeat(concat(' tc7_',n+inner_loop),2),
now(),(100.55+n+inner_loop));
insert into t4 values(400+n+inner_loop,n+inner_loop,repeat(concat(' tc3_',n+inner_loop),30),
repeat(concat(' tc4_',n+inner_loop),800),repeat(concat(' tc_',n+inner_loop),800),
repeat(concat(' tc6_',n+inner_loop),245),repeat(concat(' tc7_',n+inner_loop),245),
now(),(100.55+n+inner_loop));
insert into t5 values(400+n+inner_loop,n+inner_loop,repeat(concat(' tc3_',n+inner_loop),30),
repeat(concat(' tc4_',n+inner_loop),800),repeat(concat(' tc_',n+inner_loop),800),
repeat(concat(' tc6_',n+inner_loop),245),repeat(concat(' tc7_',n+inner_loop),245),
@ -208,25 +106,11 @@ connect (con2,localhost,root,,);
connection con1;
--reap
# 20 rows expected
select count(*) from t1;
select count(*) from t2;
select count(*) from t4;
select count(*) from t5;
select c1 from t1;
select c1 from t2;
select c1 from t4;
select c1 from t5;
connection con2;
--reap
# 20 rows expected
select count(*) from t1;
select count(*) from t2;
select count(*) from t4;
select count(*) from t5;
select c1 from t1;
select c1 from t2;
select c1 from t4;
select c1 from t5;
connection con1;
@ -234,71 +118,38 @@ connection con1;
set autocommit = 0;
# Check duplicate key constraint + insert ignore
--error ER_DUP_ENTRY
insert into t1 values (20,1,'a','a','a','a','a',now(),100.55);
insert ignore into t1 values (20,1,'a','a','a','a','a',now(),100.55);
--error ER_DUP_ENTRY
insert into t2 values (20,1,'a','a','a','a','a',now(),100.55);
insert ignore into t2 values (20,1,'a','a','a','a','a',now(),100.55);
--error ER_DUP_ENTRY
insert into t4 values (20,1,'a','a','a','a','a',now(),100.55);
insert ignore into t4 values (20,1,'a','a','a','a','a',now(),100.55);
--error ER_DUP_ENTRY
insert into t5 values (20,1,'a','a','a','a','a',now(),100.55);
insert ignore into t5 values (20,1,'a','a','a','a','a',now(),100.55);
# check rollback due to duplicate value in second record of insert
--error ER_DUP_ENTRY
insert into t1 values (1,1,'a','a','a','a','a',now(),100.55),
(20,1,'a','a','a','a','a',now(),100.55);
--error ER_DUP_ENTRY
insert into t2 values (1,1,'a','a','a','a','a',now(),100.55),
(20,1,'a','a','a','a','a',now(),100.55);
--error ER_DUP_ENTRY
insert into t4 values (1,1,'a','a','a','a','a',now(),100.55),
(20,1,'a','a','a','a','a',now(),100.55);
--error ER_DUP_ENTRY
insert into t5 values (1,1,'a','a','a','a','a',now(),100.55),
(20,1,'a','a','a','a','a',now(),100.55);
set autocommit = 1;
select c1,c2 from t1 where c1 in (20,1);
select c1,c2 from t2 where c1 in (20,1);
select c1,c2 from t4 where c1 in (20,1);
select c1,c2 from t5 where c1 in (20,1);
#replace statement
replace into t1 values (20,1,'a','a','a','a','a',now(),100.55);
replace into t2 values (20,1,'a','a','a','a','a',now(),100.55);
replace into t4 values (20,1,'a','a','a','a','a',now(),100.55);
replace into t5 values (20,1,'a','a','a','a','a',now(),100.55);
# verify row is replaced from (20,20) to (20,1)
select c1,c2,c3,c4,c5,c6,c7,c9 from t1 where c1 = 20;
select c1,c2,c3,c4,c5,c6,c7,c9 from t2 where c1 = 20;
select c1,c2,c3,c4,c5,c6,c7,c9 from t4 where c1 = 20;
select c1,c2,c3,c4,c5,c6,c7,c9 from t5 where c1 = 20;
# Update ignore. statement is ignored as 20 value exists
update ignore t1 set c1 = 20 where c1 = 140 ;
update ignore t2 set c1 = 20 where c1 = 140 ;
update ignore t4 set c1 = 20 where c1 = 140 ;
update ignore t5 set c1 = 20 where c1 = 140 ;
# see record 140 is present as last update ignored
select count(*) from t1 where c1 = 140;
select count(*) from t2 where c1 = 140;
select count(*) from t4 where c1 = 140;
select count(*) from t5 where c1 = 140;
--replace_result $MYSQLTEST_VARDIR VARDIR
eval select * into outfile "$MYSQLTEST_VARDIR/tmp/t1.outfile" from t1;
eval select * into outfile "$MYSQLTEST_VARDIR/tmp/t5.outfile" from t5;
create temporary table temp_1 engine = innodb as select * from t1 where 1=2;
create temporary table temp_1 engine = innodb as select * from t5 where 1=2;
select count(*) from temp_1;
--replace_result $MYSQLTEST_VARDIR VARDIR
eval load data infile '$MYSQLTEST_VARDIR/tmp/t1.outfile' into table temp_1;
eval load data infile '$MYSQLTEST_VARDIR/tmp/t5.outfile' into table temp_1;
select count(*) from temp_1;
--remove_file $MYSQLTEST_VARDIR/tmp/t1.outfile
--remove_file $MYSQLTEST_VARDIR/tmp/t5.outfile
# Alter table to add column and primary key
alter table temp_1 add column c10 int default 99 ,