Commit bd87c872 authored by Sergei Golubchik's avatar Sergei Golubchik

cleanup: don't generate tests with SP or PS

unless it's a test of SP or PS
parent 558ee2ee
--- suite/versioning/r/select_sp.result
+++ suite/versioning/r/select_sp.result
@@ -22,8 +22,6 @@
delete from t1 where x > 7;
insert into t1(x, y) values(3, 33);
select sys_start from t1 where x = 3 and y = 33 into @t1;
-set @x1= @t1;
-select vtq_commit_ts(@x1) into @t1;
select x, y from t1;
x y
0 100
@@ -84,7 +82,7 @@
8 108
9 109
3 33
-select x as ASOF2_x, y from t1 for system_time as of @x0;
+select x as ASOF2_x, y from t1 for system_time as of @t0;
ASOF2_x y
0 100
1 101
@@ -96,7 +94,7 @@
7 107
8 108
9 109
-select x as FROMTO2_x, y from t1 for system_time from @x0 to @x1;
+select x as FROMTO2_x, y from t1 for system_time from '0-0-0 0:0:0' to @t1;
FROMTO2_x y
0 100
1 101
@@ -108,7 +106,7 @@
7 107
8 108
9 109
-select x as BETWAND2_x, y from t1 for system_time between transaction @x0 and transaction @x1;
+select x as BETWAND2_x, y from t1 for system_time between timestamp '0-0-0 0:0:0' and timestamp @t1;
BETWAND2_x y
0 100
1 101
create procedure test_01() create table t1(
begin x int unsigned,
declare engine varchar(255) default default_engine(); y int unsigned,
declare sys_type varchar(255) default sys_datatype(default_engine()); sys_start SYS_TYPE as row start invisible,
set @str= concat(' sys_end SYS_TYPE as row end invisible,
create table t1( period for system_time (sys_start, sys_end))
x int unsigned, with system versioning engine=ENGINE;
y int unsigned,
sys_start ', sys_type, ' as row start invisible,
sys_end ', sys_type, ' as row end invisible,
period for system_time (sys_start, sys_end))
with system versioning
engine ', engine);
prepare stmt from @str; execute stmt; drop prepare stmt;
insert into t1 (x, y) values insert into t1 (x, y) values
(0, 100), (0, 100),
(1, 101), (1, 101),
...@@ -24,67 +17,14 @@ insert into t1 (x, y) values ...@@ -24,67 +17,14 @@ insert into t1 (x, y) values
(8, 108), (8, 108),
(9, 109); (9, 109);
set @t0= now(6); set @t0= now(6);
if engine = 'innodb' then
select sys_start from t1 limit 1 into @x0; select sys_start from t1 limit 1 into @x0;
end if;
delete from t1 where x = 3; delete from t1 where x = 3;
delete from t1 where x > 7; delete from t1 where x > 7;
insert into t1(x, y) values(3, 33); insert into t1(x, y) values(3, 33);
select sys_start from t1 where x = 3 and y = 33 into @t1; select sys_start from t1 where x = 3 and y = 33 into @t1;
if engine = 'innodb' then
set @x1= @t1; set @x1= @t1;
select vtq_commit_ts(@x1) into @t1; select vtq_commit_ts(@x1) into @t1;
end if;
select x, y from t1; select x, y from t1;
select x as ASOF_x, y from t1 for system_time as of timestamp @t0;
select x as FROMTO_x, y from t1 for system_time from '0-0-0 0:0:0' to timestamp @t1;
select x as BETWAND_x, y from t1 for system_time between '0-0-0 0:0:0' and timestamp @t1;
select x as ALL_x, y from t1 for system_time all;
if engine = 'innodb' then
select x as ASOF2_x, y from t1 for system_time as of @x0;
select x as FROMTO2_x, y from t1 for system_time from @x0 to @x1;
select x as BETWAND2_x, y from t1 for system_time between transaction @x0 and transaction @x1;
else
select x as ASOF2_x, y from t1 for system_time as of @t0;
select x as FROMTO2_x, y from t1 for system_time from '0-0-0 0:0:0' to @t1;
select x as BETWAND2_x, y from t1 for system_time between timestamp '0-0-0 0:0:0' and timestamp @t1;
end if;
drop table t1;
end~~
create or replace procedure test_02()
begin
declare engine varchar(255) default default_engine();
declare sys_type varchar(255) default sys_datatype(default_engine());
set @str0= concat('(
x int,
y int,
sys_start ', sys_type, ' as row start invisible,
sys_end ', sys_type, ' as row end invisible,
period for system_time (sys_start, sys_end))
with system versioning
engine ', engine);
set @str= concat('create or replace table t1', @str0);
prepare stmt from @str; execute stmt; drop prepare stmt;
set @str= concat('create or replace table t2', @str0);
prepare stmt from @str; execute stmt; drop prepare stmt;
insert into t1 values (1, 1), (1, 2), (1, 3), (4, 4), (5, 5);
insert into t2 values (1, 2), (2, 1), (3, 1);
set @t0= now(6);
select t1.x as IJ1_x1, t1.y as y1, t2.x as x2, t2.y as y2 from t1 inner join t2 on t1.x = t2.x;
select t1.x as LJ1_x1, t1.y as y1, t2.x as x2, t2.y as y2 from t1 left join t2 on t1.x = t2.x;
select t1.x as RJ1_x1, t1.y as y1, t2.x as x2, t2.y as y2 from t1 right join t2 on t1.x = t2.x;
delete from t1;
delete from t2;
select IJ2_x1,y1,x2,y2 from (select t1.x as IJ2_x1, t1.y as y1, t2.x as x2, t2.y as y2 from t1 inner join t2 on t1.x = t2.x)
for system_time as of timestamp @t0 as t;
select LJ2_x1,y1,x2,y2 from (select t1.x as LJ2_x1, t1.y as y1, t2.x as x2, t2.y as y2 from t1 left join t2 on t1.x = t2.x)
for system_time as of timestamp @t0 as t;
select RJ2_x1,y1,x2,y2 from (select t1.x as RJ2_x1, t1.y as y1, t2.x as x2, t2.y as y2 from t1 right join t2 on t1.x = t2.x)
for system_time as of timestamp @t0 as t;
drop table t1;
drop table t2;
end~~
call test_01();
x y x y
0 100 0 100
1 101 1 101
...@@ -94,6 +34,7 @@ x y ...@@ -94,6 +34,7 @@ x y
6 106 6 106
7 107 7 107
3 33 3 33
select x as ASOF_x, y from t1 for system_time as of timestamp @t0;
ASOF_x y ASOF_x y
0 100 0 100
1 101 1 101
...@@ -105,6 +46,7 @@ ASOF_x y ...@@ -105,6 +46,7 @@ ASOF_x y
7 107 7 107
8 108 8 108
9 109 9 109
select x as FROMTO_x, y from t1 for system_time from '0-0-0 0:0:0' to timestamp @t1;
FROMTO_x y FROMTO_x y
0 100 0 100
1 101 1 101
...@@ -116,6 +58,7 @@ FROMTO_x y ...@@ -116,6 +58,7 @@ FROMTO_x y
7 107 7 107
8 108 8 108
9 109 9 109
select x as BETWAND_x, y from t1 for system_time between '0-0-0 0:0:0' and timestamp @t1;
BETWAND_x y BETWAND_x y
0 100 0 100
1 101 1 101
...@@ -128,6 +71,7 @@ BETWAND_x y ...@@ -128,6 +71,7 @@ BETWAND_x y
8 108 8 108
9 109 9 109
3 33 3 33
select x as ALL_x, y from t1 for system_time all;
ALL_x y ALL_x y
0 100 0 100
1 101 1 101
...@@ -140,6 +84,7 @@ ALL_x y ...@@ -140,6 +84,7 @@ ALL_x y
8 108 8 108
9 109 9 109
3 33 3 33
select x as ASOF2_x, y from t1 for system_time as of @x0;
ASOF2_x y ASOF2_x y
0 100 0 100
1 101 1 101
...@@ -151,6 +96,7 @@ ASOF2_x y ...@@ -151,6 +96,7 @@ ASOF2_x y
7 107 7 107
8 108 8 108
9 109 9 109
select x as FROMTO2_x, y from t1 for system_time from @x0 to @x1;
FROMTO2_x y FROMTO2_x y
0 100 0 100
1 101 1 101
...@@ -162,6 +108,7 @@ FROMTO2_x y ...@@ -162,6 +108,7 @@ FROMTO2_x y
7 107 7 107
8 108 8 108
9 109 9 109
select x as BETWAND2_x, y from t1 for system_time between transaction @x0 and transaction @x1;
BETWAND2_x y BETWAND2_x y
0 100 0 100
1 101 1 101
...@@ -174,39 +121,63 @@ BETWAND2_x y ...@@ -174,39 +121,63 @@ BETWAND2_x y
8 108 8 108
9 109 9 109
3 33 3 33
call test_02(); drop table t1;
create table t1(
x int,
y int,
sys_start SYS_TYPE as row start invisible,
sys_end SYS_TYPE as row end invisible,
period for system_time (sys_start, sys_end))
with system versioning engine=ENGINE;
create table t2 like t1;
insert into t1 values (1, 1), (1, 2), (1, 3), (4, 4), (5, 5);
insert into t2 values (1, 2), (2, 1), (3, 1);
set @t0= now(6);
select t1.x as IJ1_x1, t1.y as y1, t2.x as x2, t2.y as y2 from t1 inner join t2 on t1.x = t2.x;
IJ1_x1 y1 x2 y2 IJ1_x1 y1 x2 y2
1 1 1 2 1 1 1 2
1 2 1 2 1 2 1 2
1 3 1 2 1 3 1 2
select t1.x as LJ1_x1, t1.y as y1, t2.x as x2, t2.y as y2 from t1 left join t2 on t1.x = t2.x;
LJ1_x1 y1 x2 y2 LJ1_x1 y1 x2 y2
1 1 1 2 1 1 1 2
1 2 1 2 1 2 1 2
1 3 1 2 1 3 1 2
4 4 NULL NULL 4 4 NULL NULL
5 5 NULL NULL 5 5 NULL NULL
select t1.x as RJ1_x1, t1.y as y1, t2.x as x2, t2.y as y2 from t1 right join t2 on t1.x = t2.x;
RJ1_x1 y1 x2 y2 RJ1_x1 y1 x2 y2
1 1 1 2 1 1 1 2
1 2 1 2 1 2 1 2
1 3 1 2 1 3 1 2
NULL NULL 2 1 NULL NULL 2 1
NULL NULL 3 1 NULL NULL 3 1
delete from t1;
delete from t2;
select IJ2_x1,y1,x2,y2 from (select t1.x as IJ2_x1, t1.y as y1, t2.x as x2, t2.y as y2 from t1 inner join t2 on t1.x = t2.x)
for system_time as of timestamp @t0 as t;
IJ2_x1 y1 x2 y2 IJ2_x1 y1 x2 y2
1 1 1 2 1 1 1 2
1 2 1 2 1 2 1 2
1 3 1 2 1 3 1 2
select LJ2_x1,y1,x2,y2 from (select t1.x as LJ2_x1, t1.y as y1, t2.x as x2, t2.y as y2 from t1 left join t2 on t1.x = t2.x)
for system_time as of timestamp @t0 as t;
LJ2_x1 y1 x2 y2 LJ2_x1 y1 x2 y2
1 1 1 2 1 1 1 2
1 2 1 2 1 2 1 2
1 3 1 2 1 3 1 2
4 4 NULL NULL 4 4 NULL NULL
5 5 NULL NULL 5 5 NULL NULL
select RJ2_x1,y1,x2,y2 from (select t1.x as RJ2_x1, t1.y as y1, t2.x as x2, t2.y as y2 from t1 right join t2 on t1.x = t2.x)
for system_time as of timestamp @t0 as t;
RJ2_x1 y1 x2 y2 RJ2_x1 y1 x2 y2
1 1 1 2 1 1 1 2
1 2 1 2 1 2 1 2
1 3 1 2 1 3 1 2
NULL NULL 2 1 NULL NULL 2 1
NULL NULL 3 1 NULL NULL 3 1
drop table t1;
drop table t2;
# MDEV-14686 Server crashes in Item_field::used_tables on 2nd call of SP [#422] # MDEV-14686 Server crashes in Item_field::used_tables on 2nd call of SP [#422]
create or replace table t1 (called int, bad int) with system versioning; create or replace table t1 (called int, bad int) with system versioning;
create or replace procedure bad() select * from t1 where bad in (select called from t1); create or replace procedure bad() select * from t1 where bad in (select called from t1);
...@@ -365,5 +336,3 @@ select * from (t1 for system_time all join t2 for system_time all) for system_ti ...@@ -365,5 +336,3 @@ select * from (t1 for system_time all join t2 for system_time all) for system_ti
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 1 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 1
drop view v1; drop view v1;
drop table t1, t2; drop table t1, t2;
drop procedure test_01;
drop procedure test_02;
--source suite/versioning/engines.inc --source suite/versioning/engines.inc
--source suite/versioning/common.inc --source suite/versioning/common.inc
delimiter ~~; let $engine=`select default_engine()`;
create procedure test_01() let $sys_type=`select sys_datatype(default_engine())`;
begin
declare engine varchar(255) default default_engine(); replace_result $engine ENGINE $sys_type SYS_TYPE;
declare sys_type varchar(255) default sys_datatype(default_engine()); eval create table t1(
set @str= concat('
create table t1(
x int unsigned, x int unsigned,
y int unsigned, y int unsigned,
sys_start ', sys_type, ' as row start invisible, sys_start $sys_type as row start invisible,
sys_end ', sys_type, ' as row end invisible, sys_end $sys_type as row end invisible,
period for system_time (sys_start, sys_end)) period for system_time (sys_start, sys_end))
with system versioning with system versioning engine=$engine;
engine ', engine);
prepare stmt from @str; execute stmt; drop prepare stmt; insert into t1 (x, y) values
insert into t1 (x, y) values
(0, 100), (0, 100),
(1, 101), (1, 101),
(2, 102), (2, 102),
...@@ -28,83 +24,69 @@ begin ...@@ -28,83 +24,69 @@ begin
(7, 107), (7, 107),
(8, 108), (8, 108),
(9, 109); (9, 109);
set @t0= now(6); set @t0= now(6);
if engine = 'innodb' then select sys_start from t1 limit 1 into @x0;
select sys_start from t1 limit 1 into @x0;
end if;
delete from t1 where x = 3; delete from t1 where x = 3;
delete from t1 where x > 7; delete from t1 where x > 7;
insert into t1(x, y) values(3, 33); insert into t1(x, y) values(3, 33);
select sys_start from t1 where x = 3 and y = 33 into @t1; select sys_start from t1 where x = 3 and y = 33 into @t1;
if engine = 'innodb' then if(`select '$engine' = 'innodb'`) {
set @x1= @t1; set @x1= @t1;
select vtq_commit_ts(@x1) into @t1; select vtq_commit_ts(@x1) into @t1;
end if; }
select x, y from t1; select x, y from t1;
select x as ASOF_x, y from t1 for system_time as of timestamp @t0; select x as ASOF_x, y from t1 for system_time as of timestamp @t0;
select x as FROMTO_x, y from t1 for system_time from '0-0-0 0:0:0' to timestamp @t1; select x as FROMTO_x, y from t1 for system_time from '0-0-0 0:0:0' to timestamp @t1;
select x as BETWAND_x, y from t1 for system_time between '0-0-0 0:0:0' and timestamp @t1; select x as BETWAND_x, y from t1 for system_time between '0-0-0 0:0:0' and timestamp @t1;
select x as ALL_x, y from t1 for system_time all; select x as ALL_x, y from t1 for system_time all;
if engine = 'innodb' then if(`select '$engine' = 'innodb'`) {
select x as ASOF2_x, y from t1 for system_time as of @x0; select x as ASOF2_x, y from t1 for system_time as of @x0;
select x as FROMTO2_x, y from t1 for system_time from @x0 to @x1; select x as FROMTO2_x, y from t1 for system_time from @x0 to @x1;
select x as BETWAND2_x, y from t1 for system_time between transaction @x0 and transaction @x1; select x as BETWAND2_x, y from t1 for system_time between transaction @x0 and transaction @x1;
else }
if(`select '$engine' != 'innodb'`) {
select x as ASOF2_x, y from t1 for system_time as of @t0; select x as ASOF2_x, y from t1 for system_time as of @t0;
select x as FROMTO2_x, y from t1 for system_time from '0-0-0 0:0:0' to @t1; select x as FROMTO2_x, y from t1 for system_time from '0-0-0 0:0:0' to @t1;
select x as BETWAND2_x, y from t1 for system_time between timestamp '0-0-0 0:0:0' and timestamp @t1; select x as BETWAND2_x, y from t1 for system_time between timestamp '0-0-0 0:0:0' and timestamp @t1;
end if; }
drop table t1; drop table t1;
end~~
create or replace procedure test_02() replace_result $engine ENGINE $sys_type SYS_TYPE;
begin eval create table t1(
declare engine varchar(255) default default_engine();
declare sys_type varchar(255) default sys_datatype(default_engine());
set @str0= concat('(
x int, x int,
y int, y int,
sys_start ', sys_type, ' as row start invisible, sys_start $sys_type as row start invisible,
sys_end ', sys_type, ' as row end invisible, sys_end $sys_type as row end invisible,
period for system_time (sys_start, sys_end)) period for system_time (sys_start, sys_end))
with system versioning with system versioning engine=$engine;
engine ', engine);
set @str= concat('create or replace table t1', @str0); create table t2 like t1;
prepare stmt from @str; execute stmt; drop prepare stmt;
set @str= concat('create or replace table t2', @str0); insert into t1 values (1, 1), (1, 2), (1, 3), (4, 4), (5, 5);
prepare stmt from @str; execute stmt; drop prepare stmt; insert into t2 values (1, 2), (2, 1), (3, 1);
set @t0= now(6);
insert into t1 values (1, 1), (1, 2), (1, 3), (4, 4), (5, 5);
insert into t2 values (1, 2), (2, 1), (3, 1); select t1.x as IJ1_x1, t1.y as y1, t2.x as x2, t2.y as y2 from t1 inner join t2 on t1.x = t2.x;
set @t0= now(6); select t1.x as LJ1_x1, t1.y as y1, t2.x as x2, t2.y as y2 from t1 left join t2 on t1.x = t2.x;
select t1.x as RJ1_x1, t1.y as y1, t2.x as x2, t2.y as y2 from t1 right join t2 on t1.x = t2.x;
select t1.x as IJ1_x1, t1.y as y1, t2.x as x2, t2.y as y2 from t1 inner join t2 on t1.x = t2.x;
select t1.x as LJ1_x1, t1.y as y1, t2.x as x2, t2.y as y2 from t1 left join t2 on t1.x = t2.x; delete from t1;
select t1.x as RJ1_x1, t1.y as y1, t2.x as x2, t2.y as y2 from t1 right join t2 on t1.x = t2.x; delete from t2;
delete from t1; select IJ2_x1,y1,x2,y2 from (select t1.x as IJ2_x1, t1.y as y1, t2.x as x2, t2.y as y2 from t1 inner join t2 on t1.x = t2.x)
delete from t2; for system_time as of timestamp @t0 as t;
select LJ2_x1,y1,x2,y2 from (select t1.x as LJ2_x1, t1.y as y1, t2.x as x2, t2.y as y2 from t1 left join t2 on t1.x = t2.x)
select IJ2_x1,y1,x2,y2 from (select t1.x as IJ2_x1, t1.y as y1, t2.x as x2, t2.y as y2 from t1 inner join t2 on t1.x = t2.x) for system_time as of timestamp @t0 as t;
for system_time as of timestamp @t0 as t; select RJ2_x1,y1,x2,y2 from (select t1.x as RJ2_x1, t1.y as y1, t2.x as x2, t2.y as y2 from t1 right join t2 on t1.x = t2.x)
select LJ2_x1,y1,x2,y2 from (select t1.x as LJ2_x1, t1.y as y1, t2.x as x2, t2.y as y2 from t1 left join t2 on t1.x = t2.x) for system_time as of timestamp @t0 as t;
for system_time as of timestamp @t0 as t;
select RJ2_x1,y1,x2,y2 from (select t1.x as RJ2_x1, t1.y as y1, t2.x as x2, t2.y as y2 from t1 right join t2 on t1.x = t2.x) drop table t1;
for system_time as of timestamp @t0 as t; drop table t2;
drop table t1;
drop table t2;
end~~
delimiter ;~~
call test_01();
call test_02();
--echo # MDEV-14686 Server crashes in Item_field::used_tables on 2nd call of SP [#422] --echo # MDEV-14686 Server crashes in Item_field::used_tables on 2nd call of SP [#422]
create or replace table t1 (called int, bad int) with system versioning; create or replace table t1 (called int, bad int) with system versioning;
...@@ -226,7 +208,4 @@ select * from (t1 for system_time all join t2 for system_time all) for system_ti ...@@ -226,7 +208,4 @@ select * from (t1 for system_time all join t2 for system_time all) for system_ti
drop view v1; drop view v1;
drop table t1, t2; drop table t1, t2;
drop procedure test_01;
drop procedure test_02;
-- source suite/versioning/common_finish.inc -- source suite/versioning/common_finish.inc
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