mariadb/mysql-test/suite/versioning/t/auto_increment.test
2017-05-05 20:36:32 +03:00

68 lines
2.1 KiB
Text

-- source suite/versioning/common.inc
delimiter ~~;
create procedure test_01(
sys_type varchar(255),
engine varchar(255),
fields varchar(255))
begin
set @str= concat('
create table t1(
id int unsigned auto_increment primary key,
x int unsigned,
y int unsigned,
sys_start ', sys_type, ' generated always as row start,
sys_end ', sys_type, ' generated always as row end,
period for system_time (sys_start, sys_end))
with system versioning
engine ', engine);
prepare stmt from @str; execute stmt; drop prepare stmt;
set @str= concat('
create table t2(
id int unsigned auto_increment primary key,
x int unsigned,
y int unsigned)
engine ', engine);
prepare stmt from @str; execute stmt; drop prepare stmt;
insert into t1(x, y) values(1, 11);
insert into t2(x, y) values(1, 11);
insert into t1(x, y) values(2, 12);
insert into t2(x, y) values(2, 12);
insert into t1(x, y) values(3, 13);
insert into t2(x, y) values(3, 13);
insert into t1(x, y) values(4, 14);
insert into t2(x, y) values(4, 14);
insert into t1(x, y) values(5, 15);
insert into t2(x, y) values(5, 15);
insert into t1(x, y) values(6, 16);
insert into t2(x, y) values(6, 16);
insert into t1(x, y) values(7, 17);
insert into t2(x, y) values(7, 17);
insert into t1(x, y) values(8, 18);
insert into t2(x, y) values(8, 18);
insert into t1(x, y) values(9, 19);
insert into t2(x, y) values(9, 19);
select t1.x = t2.x and t1.y = t2.y as A, t1.x, t1.y, t2.x, t2.y from t1 inner join t2 on t1.id = t2.id;
delete from t1 where x = 2;
delete from t2 where x = 2;
select t1.x = t2.x and t1.y = t2.y as A, t1.x, t1.y, t2.x, t2.y from t1 inner join t2 on t1.id = t2.id;
delete from t1 where x > 7;
delete from t2 where x > 7;
select t1.x = t2.x and t1.y = t2.y as A, t1.x, t1.y, t2.x, t2.y from t1 inner join t2 on t1.id = t2.id;
drop table t1;
drop table t2;
end~~
delimiter ;~~
call test_01('timestamp(6)', 'myisam', 'sys_end');
call test_01('bigint unsigned', 'innodb', 'vtq_commit_ts(sys_end)');
call verify_vtq;
drop procedure test_01;
-- source suite/versioning/common_finish.inc