mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Tests: moved to dedicated versioning suite
Run `mtr --suite=versioning` or `mtr versioning.<test-name>`
This commit is contained in:
336
mysql-test/suite/versioning/r/insert.result
Normal file
336
mysql-test/suite/versioning/r/insert.result
Normal file
@ -0,0 +1,336 @@
|
||||
set @@session.time_zone='+00:00';
|
||||
select ifnull(max(trx_id), 0) into @start_trx_id from information_schema.innodb_vtq;
|
||||
create procedure if not exists verify_vtq()
|
||||
begin
|
||||
set @i= 0;
|
||||
select
|
||||
@i:= @i + 1 as No,
|
||||
trx_id > 0 as A,
|
||||
begin_ts > '1-1-1 0:0:0' as B,
|
||||
commit_ts > begin_ts as C,
|
||||
concurr_trx is null as D
|
||||
from information_schema.innodb_vtq
|
||||
where trx_id > @start_trx_id;
|
||||
select ifnull(max(trx_id), 0)
|
||||
into @start_trx_id
|
||||
from information_schema.innodb_vtq;
|
||||
end~~
|
||||
create procedure test_01(
|
||||
sys_type varchar(255),
|
||||
engine varchar(255),
|
||||
fields varchar(255))
|
||||
begin
|
||||
set @str= concat('
|
||||
create table t1(
|
||||
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;
|
||||
insert into t1(x, y) values(3, 4);
|
||||
insert into t1(x, y) values(2, 3);
|
||||
insert into t1 values(40, 33);
|
||||
set @str= concat('select x, y, ', fields, ' from t1');
|
||||
prepare stmt from @str; execute stmt; drop prepare stmt;
|
||||
drop table t1;
|
||||
end~~
|
||||
create procedure test_02(
|
||||
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;
|
||||
insert into t1(x, y) values(33, 44);
|
||||
insert into t1(id, x, y) values(20, 33, 44);
|
||||
insert into t1 values(40, 33, 44);
|
||||
set @str= concat('select id, x, y, ', fields, ' from t1');
|
||||
prepare stmt from @str; execute stmt; drop prepare stmt;
|
||||
drop table t1;
|
||||
end~~
|
||||
create procedure test_03(
|
||||
sys_type varchar(255),
|
||||
engine varchar(255),
|
||||
fields varchar(255))
|
||||
begin
|
||||
set @str= concat('
|
||||
create table t1(
|
||||
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;
|
||||
create view vt1_1 as select x, y from t1;
|
||||
create view vt1_2 as select x, y, sys_end from t1;
|
||||
insert into t1(x, y) values(8001, 9001);
|
||||
insert into vt1_1(x, y) values(1001, 2001);
|
||||
insert into vt1_1 values(1002, 2002);
|
||||
insert into vt1_2(x, y) values(3001, 4001);
|
||||
set @str= concat('select x, y, ', fields, ' from t1');
|
||||
prepare stmt from @str; execute stmt; drop prepare stmt;
|
||||
select x, y from vt1_1;
|
||||
set @str= concat('select x, y, ', fields, ' from vt1_2');
|
||||
prepare stmt from @str; execute stmt; drop prepare stmt;
|
||||
end~~
|
||||
create procedure test_04(
|
||||
sys_type varchar(255),
|
||||
engine varchar(255),
|
||||
fields varchar(255))
|
||||
begin
|
||||
set @str= concat('
|
||||
create table t1(
|
||||
id bigint primary key,
|
||||
a int,
|
||||
b int)
|
||||
with system versioning
|
||||
engine ', engine);
|
||||
prepare stmt from @str; execute stmt; drop prepare stmt;
|
||||
insert into t1 values(1, 1, 1);
|
||||
select sys_trx_start, sys_trx_end from t1 into @sys_start, @sys_end;
|
||||
select id, a, b from t1;
|
||||
insert into t1 values(2, 2, 2);
|
||||
select id, a, b, sys_trx_start > @sys_start as C, sys_trx_end = @sys_end as D from t1 where id = 2;
|
||||
drop table t1;
|
||||
end~~
|
||||
create procedure test_05(
|
||||
sys_type varchar(255),
|
||||
engine varchar(255),
|
||||
fields varchar(255))
|
||||
begin
|
||||
set @str= concat('(
|
||||
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);
|
||||
set @str2= concat('create table t1', @str);
|
||||
prepare stmt from @str2; execute stmt; drop prepare stmt;
|
||||
set @str2= concat('create table t2', @str);
|
||||
prepare stmt from @str2; execute stmt; drop prepare stmt;
|
||||
insert into t1(x, y) values
|
||||
(1, 1000),
|
||||
(2, 2000),
|
||||
(3, 3000),
|
||||
(4, 4000),
|
||||
(5, 5000),
|
||||
(6, 6000),
|
||||
(7, 7000),
|
||||
(8, 8000),
|
||||
(9, 9000);
|
||||
delete from t1 where x >= 1;
|
||||
insert into t1(x, y) values
|
||||
(1, 1001),
|
||||
(2, 2001),
|
||||
(3, 3001),
|
||||
(4, 4001),
|
||||
(5, 5001),
|
||||
(6, 6001),
|
||||
(7, 7001),
|
||||
(8, 8001),
|
||||
(9, 9001);
|
||||
insert into t2 select x, y from t1 for system_time between timestamp '0000-0-0 0:0:0' and timestamp '9999-1-1 0:0:0';
|
||||
select x, y from t1;
|
||||
select x, y from t2;
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
end~~
|
||||
call test_01('timestamp(6)', 'myisam', 'sys_end');
|
||||
x y sys_end
|
||||
3 4 2038-01-19 03:14:07.000000
|
||||
2 3 2038-01-19 03:14:07.000000
|
||||
40 33 2038-01-19 03:14:07.000000
|
||||
call test_01('bigint unsigned', 'innodb', 'commit_ts(sys_end)');
|
||||
x y commit_ts(sys_end)
|
||||
3 4 2038-01-19 03:14:07.000000
|
||||
2 3 2038-01-19 03:14:07.000000
|
||||
40 33 2038-01-19 03:14:07.000000
|
||||
call test_02('timestamp(6)', 'myisam', 'sys_end');
|
||||
id x y sys_end
|
||||
1 33 44 2038-01-19 03:14:07.000000
|
||||
20 33 44 2038-01-19 03:14:07.000000
|
||||
40 33 44 2038-01-19 03:14:07.000000
|
||||
call test_02('bigint unsigned', 'innodb', 'commit_ts(sys_end)');
|
||||
id x y commit_ts(sys_end)
|
||||
1 33 44 2038-01-19 03:14:07.000000
|
||||
20 33 44 2038-01-19 03:14:07.000000
|
||||
40 33 44 2038-01-19 03:14:07.000000
|
||||
call test_03('timestamp(6)', 'myisam', 'sys_end');
|
||||
x y sys_end
|
||||
8001 9001 2038-01-19 03:14:07.000000
|
||||
1001 2001 2038-01-19 03:14:07.000000
|
||||
1002 2002 2038-01-19 03:14:07.000000
|
||||
3001 4001 2038-01-19 03:14:07.000000
|
||||
x y
|
||||
8001 9001
|
||||
1001 2001
|
||||
1002 2002
|
||||
3001 4001
|
||||
x y sys_end
|
||||
8001 9001 2038-01-19 03:14:07.000000
|
||||
1001 2001 2038-01-19 03:14:07.000000
|
||||
1002 2002 2038-01-19 03:14:07.000000
|
||||
3001 4001 2038-01-19 03:14:07.000000
|
||||
insert into t1(x, y, sys_end) values(8001, 9001, '2015-1-1 1:1:1');
|
||||
ERROR HY000: Generated field for System Versioning cannot be set by user
|
||||
insert into vt1_2 values(3002, 4002, '2015-2-2 2:2:2');
|
||||
ERROR HY000: Generated field for System Versioning cannot be set by user
|
||||
drop table t1;
|
||||
drop view vt1_1;
|
||||
drop view vt1_2;
|
||||
call test_03('bigint unsigned', 'innodb', 'commit_ts(sys_end)');
|
||||
x y commit_ts(sys_end)
|
||||
8001 9001 2038-01-19 03:14:07.000000
|
||||
1001 2001 2038-01-19 03:14:07.000000
|
||||
1002 2002 2038-01-19 03:14:07.000000
|
||||
3001 4001 2038-01-19 03:14:07.000000
|
||||
x y
|
||||
8001 9001
|
||||
1001 2001
|
||||
1002 2002
|
||||
3001 4001
|
||||
x y commit_ts(sys_end)
|
||||
8001 9001 2038-01-19 03:14:07.000000
|
||||
1001 2001 2038-01-19 03:14:07.000000
|
||||
1002 2002 2038-01-19 03:14:07.000000
|
||||
3001 4001 2038-01-19 03:14:07.000000
|
||||
insert into t1(x, y, sys_end) values(8001, 9001, 1111111);
|
||||
ERROR HY000: Generated field for System Versioning cannot be set by user
|
||||
insert into vt1_2 values(3002, 4002, 2222222);
|
||||
ERROR HY000: Generated field for System Versioning cannot be set by user
|
||||
drop table t1;
|
||||
drop view vt1_1;
|
||||
drop view vt1_2;
|
||||
call test_04('timestamp(6)', 'myisam', 'sys_end');
|
||||
id a b
|
||||
1 1 1
|
||||
id a b C D
|
||||
2 2 2 1 1
|
||||
call test_04('bigint unsigned', 'innodb', 'commit_ts(sys_end)');
|
||||
id a b
|
||||
1 1 1
|
||||
id a b C D
|
||||
2 2 2 1 1
|
||||
call test_05('timestamp(6)', 'myisam', 'sys_end');
|
||||
x y
|
||||
1 1001
|
||||
2 2001
|
||||
3 3001
|
||||
4 4001
|
||||
5 5001
|
||||
6 6001
|
||||
7 7001
|
||||
8 8001
|
||||
9 9001
|
||||
x y
|
||||
1 1000
|
||||
2 2000
|
||||
3 3000
|
||||
4 4000
|
||||
5 5000
|
||||
6 6000
|
||||
7 7000
|
||||
8 8000
|
||||
9 9000
|
||||
1 1001
|
||||
2 2001
|
||||
3 3001
|
||||
4 4001
|
||||
5 5001
|
||||
6 6001
|
||||
7 7001
|
||||
8 8001
|
||||
9 9001
|
||||
call test_05('bigint unsigned', 'innodb', 'commit_ts(sys_end)');
|
||||
x y
|
||||
1 1001
|
||||
2 2001
|
||||
3 3001
|
||||
4 4001
|
||||
5 5001
|
||||
6 6001
|
||||
7 7001
|
||||
8 8001
|
||||
9 9001
|
||||
x y
|
||||
1 1000
|
||||
2 2000
|
||||
3 3000
|
||||
4 4000
|
||||
5 5000
|
||||
6 6000
|
||||
7 7000
|
||||
8 8000
|
||||
9 9000
|
||||
1 1001
|
||||
2 2001
|
||||
3 3001
|
||||
4 4001
|
||||
5 5001
|
||||
6 6001
|
||||
7 7001
|
||||
8 8001
|
||||
9 9001
|
||||
call verify_vtq;
|
||||
No A B C D
|
||||
1 1 1 1 1
|
||||
2 1 1 1 1
|
||||
3 1 1 1 1
|
||||
4 1 1 1 1
|
||||
5 1 1 1 1
|
||||
6 1 1 1 1
|
||||
7 1 1 1 1
|
||||
8 1 1 1 1
|
||||
9 1 1 1 1
|
||||
10 1 1 1 1
|
||||
11 1 1 1 1
|
||||
12 1 1 1 1
|
||||
13 1 1 1 1
|
||||
14 1 1 1 1
|
||||
15 1 1 1 1
|
||||
16 1 1 1 1
|
||||
create table t1(
|
||||
x int unsigned,
|
||||
sys_start bigint unsigned generated always as row start,
|
||||
sys_end bigint unsigned generated always as row end,
|
||||
period for system_time (sys_start, sys_end))
|
||||
with system versioning engine=innodb;
|
||||
create table t2(x int unsigned) engine=innodb;
|
||||
start transaction;
|
||||
insert into t1(x) values(1);
|
||||
commit;
|
||||
call verify_vtq;
|
||||
No A B C D
|
||||
1 1 1 1 1
|
||||
start transaction;
|
||||
insert into t2(x) values(1);
|
||||
savepoint a;
|
||||
insert into t1(x) values(1);
|
||||
rollback to a;
|
||||
commit;
|
||||
call verify_vtq;
|
||||
No A B C D
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
drop procedure test_01;
|
||||
drop procedure test_02;
|
||||
drop procedure test_03;
|
||||
drop procedure test_04;
|
||||
drop procedure test_05;
|
||||
drop procedure verify_vtq;
|
Reference in New Issue
Block a user