mirror of
https://github.com/MariaDB/server.git
synced 2025-01-29 10:14:19 +01:00
Tests: removed from main suite
This commit is contained in:
parent
d3b737d910
commit
44e581ebfc
26 changed files with 1 additions and 2295 deletions
|
@ -537,62 +537,3 @@ pk
|
|||
-5
|
||||
1
|
||||
drop table t1;
|
||||
#
|
||||
# System Versioning Support
|
||||
#
|
||||
#
|
||||
CREATE TABLE t1(id INT UNSIGNED AUTO_INCREMENT, x INT UNSIGNED, y INT UNSIGNED, Sys_start TIMESTAMP(6) GENERATED ALWAYS AS ROW START, Sys_end TIMESTAMP(6) GENERATED ALWAYS AS ROW END, PERIOD FOR SYSTEM_TIME (Sys_start, Sys_end), PRIMARY KEY (id)) WITH SYSTEM VERSIONING;
|
||||
CREATE TABLE T1(id INT UNSIGNED AUTO_INCREMENT, x INT UNSIGNED, y INT UNSIGNED, PRIMARY KEY (id));
|
||||
INSERT INTO t1(x, y) VALUES(1, 11);
|
||||
INSERT INTO T1(x, y) VALUES(1, 11);
|
||||
INSERT INTO t1(x, y) VALUES(2, 12);
|
||||
INSERT INTO T1(x, y) VALUES(2, 12);
|
||||
INSERT INTO t1(x, y) VALUES(3, 13);
|
||||
INSERT INTO T1(x, y) VALUES(3, 13);
|
||||
INSERT INTO t1(x, y) VALUES(4, 14);
|
||||
INSERT INTO T1(x, y) VALUES(4, 14);
|
||||
INSERT INTO t1(x, y) VALUES(5, 15);
|
||||
INSERT INTO T1(x, y) VALUES(5, 15);
|
||||
INSERT INTO t1(x, y) VALUES(6, 16);
|
||||
INSERT INTO T1(x, y) VALUES(6, 16);
|
||||
INSERT INTO t1(x, y) VALUES(7, 17);
|
||||
INSERT INTO T1(x, y) VALUES(7, 17);
|
||||
INSERT INTO t1(x, y) VALUES(8, 18);
|
||||
INSERT INTO T1(x, y) VALUES(8, 18);
|
||||
INSERT INTO t1(x, y) VALUES(9, 19);
|
||||
INSERT INTO T1(x, y) VALUES(9, 19);
|
||||
SELECT t1.x = T1.x AND t1.y = T1.y, t1.x, t1.y, T1.x, T1.y FROM t1 INNER JOIN T1 ON(t1.id = T1.id);
|
||||
t1.x = T1.x AND t1.y = T1.y x y x y
|
||||
1 1 11 1 11
|
||||
1 2 12 2 12
|
||||
1 3 13 3 13
|
||||
1 4 14 4 14
|
||||
1 5 15 5 15
|
||||
1 6 16 6 16
|
||||
1 7 17 7 17
|
||||
1 8 18 8 18
|
||||
1 9 19 9 19
|
||||
DELETE FROM t1 WHERE x=2;
|
||||
DELETE FROM T1 WHERE x=2;
|
||||
SELECT t1.x = T1.x AND t1.y = T1.y, t1.x, t1.y, T1.x, T1.y FROM t1 INNER JOIN T1 ON(t1.id = T1.id);
|
||||
t1.x = T1.x AND t1.y = T1.y x y x y
|
||||
1 1 11 1 11
|
||||
1 3 13 3 13
|
||||
1 4 14 4 14
|
||||
1 5 15 5 15
|
||||
1 6 16 6 16
|
||||
1 7 17 7 17
|
||||
1 8 18 8 18
|
||||
1 9 19 9 19
|
||||
DELETE FROM t1 WHERE x>7;
|
||||
DELETE FROM T1 WHERE x>7;
|
||||
SELECT t1.x = T1.x AND t1.y = T1.y, t1.x, t1.y, T1.x, T1.y FROM t1 INNER JOIN T1 ON(t1.id = T1.id);
|
||||
t1.x = T1.x AND t1.y = T1.y x y x y
|
||||
1 1 11 1 11
|
||||
1 3 13 3 13
|
||||
1 4 14 4 14
|
||||
1 5 15 5 15
|
||||
1 6 16 6 16
|
||||
1 7 17 7 17
|
||||
DROP TABLE t1;
|
||||
DROP TABLE T1;
|
||||
|
|
|
@ -1931,188 +1931,3 @@ create table t1 (i int, j int, key(i), key(i)) as select 1 as i, 2 as j;
|
|||
Warnings:
|
||||
Note 1831 Duplicate index `i_2`. This is deprecated and will be disallowed in a future release
|
||||
drop table t1;
|
||||
#
|
||||
# Test for SYSTEM VERSIONING CREATE
|
||||
#
|
||||
create table t1 (
|
||||
XNo INT UNSIGNED,
|
||||
Sys_start TIMESTAMP(6) GENERATED ALWAYS AS ROW START,
|
||||
Sys_end TIMESTAMP(6) GENERATED ALWAYS AS ROW END,
|
||||
PERIOD FOR SYSTEM_TIME (Sys_start, Sys_end)
|
||||
) WITH SYSTEM VERSIONING;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`XNo` int(10) unsigned DEFAULT NULL,
|
||||
`Sys_start` timestamp(6) NOT NULL GENERATED AS ROW START,
|
||||
`Sys_end` timestamp(6) NOT NULL GENERATED AS ROW END,
|
||||
PERIOD FOR SYSTEM_TIME (`Sys_start`, `Sys_end`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING
|
||||
drop table if exists t1;
|
||||
# Versioning fields are set implicitly.
|
||||
create table t1 (
|
||||
XNo INT UNSIGNED
|
||||
) WITH SYSTEM VERSIONING;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`XNo` int(10) unsigned DEFAULT NULL,
|
||||
`sys_trx_start` timestamp(6) NOT NULL GENERATED AS ROW START,
|
||||
`sys_trx_end` timestamp(6) NOT NULL GENERATED AS ROW END,
|
||||
PERIOD FOR SYSTEM_TIME (`sys_trx_start`, `sys_trx_end`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING
|
||||
drop table if exists t1;
|
||||
create table t1 (
|
||||
XNo INT UNSIGNED,
|
||||
Sys_start TIMESTAMP(6) GENERATED ALWAYS AS ROW START,
|
||||
Sys_start2 TIMESTAMP(6) GENERATED ALWAYS AS ROW START,
|
||||
Sys_end TIMESTAMP(6) GENERATED ALWAYS AS ROW END,
|
||||
PERIOD FOR SYSTEM_TIME (Sys_start, Sys_end)
|
||||
) WITH SYSTEM VERSIONING;
|
||||
ERROR HY000: 'Generated as row start' specified more than once
|
||||
create table t1 (
|
||||
XNo INT UNSIGNED,
|
||||
Sys_start TIMESTAMP(6) GENERATED ALWAYS AS ROW START,
|
||||
Sys_end2 TIMESTAMP(6) GENERATED ALWAYS AS ROW END,
|
||||
PERIOD FOR SYSTEM_TIME (Sys_start, Sys_end)
|
||||
) WITH SYSTEM VERSIONING;
|
||||
ERROR HY000: Second column in 'period for system time' must be equal to 'generated as row end' column
|
||||
create table t1 (
|
||||
XNo INT UNSIGNED,
|
||||
Sys_start TIMESTAMP(6) GENERATED ALWAYS AS ROW START,
|
||||
Sys_end TIMESTAMP(6) GENERATED ALWAYS AS ROW END,
|
||||
Sys_end2 TIMESTAMP(6) GENERATED ALWAYS AS ROW END,
|
||||
PERIOD FOR SYSTEM_TIME (Sys_start, Sys_end)
|
||||
) WITH SYSTEM VERSIONING;
|
||||
ERROR HY000: Generated as row end specified more than once
|
||||
create table t1 (
|
||||
XNo INT UNSIGNED,
|
||||
PERIOD FOR SYSTEM_TIME (Sys_start, Sys_end)
|
||||
) WITH SYSTEM VERSIONING;
|
||||
ERROR HY000: 'Generated as row start' not specified
|
||||
create table t1 (
|
||||
XNo INT UNSIGNED,
|
||||
Sys_start TIMESTAMP(6) GENERATED ALWAYS AS ROW START,
|
||||
Sys_end TIMESTAMP(6) GENERATED ALWAYS AS ROW END,
|
||||
Sys_end2 TIMESTAMP(6) GENERATED ALWAYS AS ROW END,
|
||||
PERIOD FOR SYSTEM_TIME (Sys_start, Sys_end)
|
||||
);
|
||||
ERROR HY000: Generated as row end specified more than once
|
||||
create table t1 (
|
||||
XNo INT UNSIGNED,
|
||||
Sys_start TIMESTAMP(6) GENERATED ALWAYS AS ROW START,
|
||||
Sys_end TIMESTAMP(6) GENERATED ALWAYS AS ROW END,
|
||||
PERIOD FOR SYSTEM_TIME (Sys_insert, Sys_remove)
|
||||
) WITH SYSTEM VERSIONING;
|
||||
ERROR HY000: First column in 'period for system time' must be equal to 'generated as row start' column
|
||||
create table t1 (
|
||||
XNo INT UNSIGNED,
|
||||
Sys_start TIMESTAMP(6) GENERATED ALWAYS AS ROW START,
|
||||
Sys_end TIMESTAMP(6) GENERATED ALWAYS AS ROW END,
|
||||
PERIOD FOR SYSTEM_TIME (Sys_start, Sys_end)
|
||||
);
|
||||
ERROR HY000: 'With system versioning' is missing
|
||||
create table t1 (
|
||||
XNo INT UNSIGNED,
|
||||
Sys_start TIMESTAMP(6) GENERATED ALWAYS AS ROW START,
|
||||
Sys_end TIMESTAMP(6) GENERATED ALWAYS AS ROW END,
|
||||
PERIOD FOR SYSTEM_TIME (Sys_start, Sys_start)
|
||||
);
|
||||
ERROR HY000: 'Period for system_time' must contain two different columns
|
||||
create table t1 (
|
||||
XNo INT UNSIGNED,
|
||||
Sys_start INT GENERATED ALWAYS AS ROW START,
|
||||
Sys_end TIMESTAMP(6) GENERATED ALWAYS AS ROW END,
|
||||
PERIOD FOR SYSTEM_TIME (Sys_start, Sys_end)
|
||||
) WITH SYSTEM VERSIONING;
|
||||
ERROR HY000: System start field must be of type TIMESTAMP
|
||||
create table t1 (
|
||||
XNo INT UNSIGNED,
|
||||
Sys_start TIMESTAMP(6) GENERATED ALWAYS AS ROW START,
|
||||
Sys_end INT GENERATED ALWAYS AS ROW END,
|
||||
PERIOD FOR SYSTEM_TIME (Sys_start, Sys_end)
|
||||
) WITH SYSTEM VERSIONING;
|
||||
ERROR HY000: System end field must be of type TIMESTAMP
|
||||
CREATE TABLE t1 (
|
||||
A INT WITH SYSTEM VERSIONING,
|
||||
B INT
|
||||
);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`A` int(11) DEFAULT NULL,
|
||||
`B` int(11) DEFAULT NULL WITHOUT SYSTEM VERSIONING,
|
||||
`sys_trx_start` timestamp(6) NOT NULL GENERATED AS ROW START,
|
||||
`sys_trx_end` timestamp(6) NOT NULL GENERATED AS ROW END,
|
||||
PERIOD FOR SYSTEM_TIME (`sys_trx_start`, `sys_trx_end`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (
|
||||
A INT WITH SYSTEM VERSIONING,
|
||||
B INT
|
||||
) WITH SYSTEM VERSIONING;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`A` int(11) DEFAULT NULL,
|
||||
`B` int(11) DEFAULT NULL,
|
||||
`sys_trx_start` timestamp(6) NOT NULL GENERATED AS ROW START,
|
||||
`sys_trx_end` timestamp(6) NOT NULL GENERATED AS ROW END,
|
||||
PERIOD FOR SYSTEM_TIME (`sys_trx_start`, `sys_trx_end`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (
|
||||
A INT,
|
||||
B INT WITHOUT SYSTEM VERSIONING
|
||||
);
|
||||
ERROR HY000: Every field specified unversioned in versioned table
|
||||
CREATE TABLE t1 (
|
||||
A INT,
|
||||
B INT WITHOUT SYSTEM VERSIONING
|
||||
) WITH SYSTEM VERSIONING;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`A` int(11) DEFAULT NULL,
|
||||
`B` int(11) DEFAULT NULL WITHOUT SYSTEM VERSIONING,
|
||||
`sys_trx_start` timestamp(6) NOT NULL GENERATED AS ROW START,
|
||||
`sys_trx_end` timestamp(6) NOT NULL GENERATED AS ROW END,
|
||||
PERIOD FOR SYSTEM_TIME (`sys_trx_start`, `sys_trx_end`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (
|
||||
A INT WITH SYSTEM VERSIONING,
|
||||
B INT WITHOUT SYSTEM VERSIONING
|
||||
);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`A` int(11) DEFAULT NULL,
|
||||
`B` int(11) DEFAULT NULL WITHOUT SYSTEM VERSIONING,
|
||||
`sys_trx_start` timestamp(6) NOT NULL GENERATED AS ROW START,
|
||||
`sys_trx_end` timestamp(6) NOT NULL GENERATED AS ROW END,
|
||||
PERIOD FOR SYSTEM_TIME (`sys_trx_start`, `sys_trx_end`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (
|
||||
A INT WITH SYSTEM VERSIONING,
|
||||
B INT WITHOUT SYSTEM VERSIONING
|
||||
) WITH SYSTEM VERSIONING;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`A` int(11) DEFAULT NULL,
|
||||
`B` int(11) DEFAULT NULL WITHOUT SYSTEM VERSIONING,
|
||||
`sys_trx_start` timestamp(6) NOT NULL GENERATED AS ROW START,
|
||||
`sys_trx_end` timestamp(6) NOT NULL GENERATED AS ROW END,
|
||||
PERIOD FOR SYSTEM_TIME (`sys_trx_start`, `sys_trx_end`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (
|
||||
A INT WITHOUT SYSTEM VERSIONING
|
||||
);
|
||||
ERROR HY000: Every field specified unversioned in versioned table
|
||||
CREATE TABLE t1 (
|
||||
A INT WITHOUT SYSTEM VERSIONING
|
||||
) WITH SYSTEM VERSIONING;
|
||||
ERROR HY000: Every field specified unversioned in versioned table
|
||||
|
|
|
@ -525,193 +525,3 @@ DELETE v2 FROM v2;
|
|||
ERROR HY000: Can not delete from join view 'test.v2'
|
||||
DROP VIEW v2, v1;
|
||||
DROP TABLE t1, t2;
|
||||
#
|
||||
# System Versioning Support
|
||||
#
|
||||
#
|
||||
set @@session.time_zone='+00:00';
|
||||
select ifnull(max(trx_id), 0) into @start_trx_id from information_schema.innodb_vtq;
|
||||
create procedure test_01(
|
||||
sys_type varchar(255),
|
||||
engine varchar(255),
|
||||
fields varchar(255))
|
||||
begin
|
||||
set @str= concat('
|
||||
create table t1(
|
||||
XNo 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(XNo) values(0);
|
||||
insert into t1(XNo) values(1);
|
||||
insert into t1(XNo) values(2);
|
||||
insert into t1(XNo) values(3);
|
||||
insert into t1(XNo) values(4);
|
||||
insert into t1(XNo) values(5);
|
||||
insert into t1(XNo) values(6);
|
||||
insert into t1(XNo) values(7);
|
||||
insert into t1(XNo) values(8);
|
||||
insert into t1(XNo) values(9);
|
||||
set @str= concat('select XNo, ',
|
||||
fields, " < '2038-01-19 03:14:07'
|
||||
from t1 for system_time
|
||||
between timestamp '0000-0-0 0:0:0'
|
||||
and timestamp '2038-01-19 04:14:07'");
|
||||
prepare stmt from @str; execute stmt;
|
||||
delete from t1 where XNo = 0;
|
||||
execute stmt;
|
||||
delete from t1 where XNo = 1;
|
||||
execute stmt;
|
||||
delete from t1 where XNo > 5;
|
||||
create view vt1 as select XNo from t1;
|
||||
select XNo from vt1;
|
||||
delete from vt1 where XNo = 3;
|
||||
select XNo from vt1;
|
||||
execute stmt; drop prepare stmt;
|
||||
drop view vt1;
|
||||
drop table t1;
|
||||
end~~
|
||||
call test_01('timestamp(6)', 'myisam', 'sys_end');
|
||||
XNo sys_end < '2038-01-19 03:14:07'
|
||||
0 0
|
||||
1 0
|
||||
2 0
|
||||
3 0
|
||||
4 0
|
||||
5 0
|
||||
6 0
|
||||
7 0
|
||||
8 0
|
||||
9 0
|
||||
XNo sys_end < '2038-01-19 03:14:07'
|
||||
0 1
|
||||
1 0
|
||||
2 0
|
||||
3 0
|
||||
4 0
|
||||
5 0
|
||||
6 0
|
||||
7 0
|
||||
8 0
|
||||
9 0
|
||||
XNo sys_end < '2038-01-19 03:14:07'
|
||||
0 1
|
||||
1 1
|
||||
2 0
|
||||
3 0
|
||||
4 0
|
||||
5 0
|
||||
6 0
|
||||
7 0
|
||||
8 0
|
||||
9 0
|
||||
XNo
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
XNo
|
||||
2
|
||||
4
|
||||
5
|
||||
XNo sys_end < '2038-01-19 03:14:07'
|
||||
0 1
|
||||
1 1
|
||||
2 0
|
||||
3 1
|
||||
4 0
|
||||
5 0
|
||||
6 1
|
||||
7 1
|
||||
8 1
|
||||
9 1
|
||||
call test_01('bigint unsigned', 'innodb', 'commit_ts(sys_end)');
|
||||
XNo commit_ts(sys_end) < '2038-01-19 03:14:07'
|
||||
0 0
|
||||
1 0
|
||||
2 0
|
||||
3 0
|
||||
4 0
|
||||
5 0
|
||||
6 0
|
||||
7 0
|
||||
8 0
|
||||
9 0
|
||||
XNo commit_ts(sys_end) < '2038-01-19 03:14:07'
|
||||
0 1
|
||||
1 0
|
||||
2 0
|
||||
3 0
|
||||
4 0
|
||||
5 0
|
||||
6 0
|
||||
7 0
|
||||
8 0
|
||||
9 0
|
||||
XNo commit_ts(sys_end) < '2038-01-19 03:14:07'
|
||||
0 1
|
||||
1 1
|
||||
2 0
|
||||
3 0
|
||||
4 0
|
||||
5 0
|
||||
6 0
|
||||
7 0
|
||||
8 0
|
||||
9 0
|
||||
XNo
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
XNo
|
||||
2
|
||||
4
|
||||
5
|
||||
XNo commit_ts(sys_end) < '2038-01-19 03:14:07'
|
||||
0 1
|
||||
1 1
|
||||
2 0
|
||||
3 1
|
||||
4 0
|
||||
5 0
|
||||
6 1
|
||||
7 1
|
||||
8 1
|
||||
9 1
|
||||
drop procedure test_01;
|
||||
create procedure 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~~
|
||||
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
|
||||
drop procedure verify_vtq;
|
||||
|
|
|
@ -717,215 +717,3 @@ insert ignore into t1 values (1,12);
|
|||
Warnings:
|
||||
Warning 1062 Duplicate entry '1' for key 'f1'
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# System Versioning Support
|
||||
#
|
||||
#
|
||||
set @@session.time_zone='+00:00';
|
||||
select ifnull(max(trx_id), 0) into @start_trx_id from information_schema.innodb_vtq;
|
||||
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~~
|
||||
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
|
||||
drop procedure test_01;
|
||||
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~~
|
||||
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
|
||||
drop procedure test_02;
|
||||
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~~
|
||||
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;
|
||||
drop procedure test_03;
|
||||
create procedure 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~~
|
||||
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
|
||||
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 verify_vtq;
|
||||
CREATE TABLE t1(
|
||||
id BIGINT PRIMARY KEY,
|
||||
A INT,
|
||||
B INT
|
||||
) WITH SYSTEM VERSIONING;
|
||||
INSERT INTO t1 VALUES(1, 1, 1);
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1(
|
||||
id BIGINT PRIMARY KEY,
|
||||
A INT,
|
||||
B INT
|
||||
) WITH SYSTEM VERSIONING ENGINE=INNODB;
|
||||
INSERT INTO t1 VALUES(1, 1, 1);
|
||||
DROP TABLE t1;
|
||||
|
|
|
@ -856,136 +856,3 @@ INSERT IGNORE INTO t1 SELECT t1.a FROM t1,t1 t2,t1 t3,t1 t4,t1 t5,t1 t6,t1 t7;
|
|||
SET GLOBAL myisam_data_pointer_size = @old_myisam_data_pointer_size;
|
||||
DROP TABLE t1;
|
||||
End of 5.1 tests
|
||||
#
|
||||
# System Versioning Support
|
||||
#
|
||||
#
|
||||
set @@session.time_zone='+00:00';
|
||||
select ifnull(max(trx_id), 0) into @start_trx_id from information_schema.innodb_vtq;
|
||||
create procedure test_01(
|
||||
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
|
||||
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_01('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
|
||||
drop procedure test_01;
|
||||
create procedure 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~~
|
||||
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
|
||||
drop procedure verify_vtq;
|
||||
|
|
|
@ -412,119 +412,3 @@ select if( @stamp1 = @stamp2, "correct", "wrong");
|
|||
if( @stamp1 = @stamp2, "correct", "wrong")
|
||||
correct
|
||||
drop table t1;
|
||||
#
|
||||
# System Versioning Support
|
||||
#
|
||||
#
|
||||
set @@session.time_zone='+00:00';
|
||||
select ifnull(max(trx_id), 0) into @start_trx_id from information_schema.innodb_vtq;
|
||||
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),
|
||||
primary key(x, y))
|
||||
with system versioning
|
||||
engine ', engine);
|
||||
prepare stmt from @str; 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);
|
||||
insert into t1(x, y) values(3, 3000) on duplicate key update y = y+1;
|
||||
insert into t1(x, y) values(4, 4000) on duplicate key update y = y+1;
|
||||
insert into t1(x, y) values(4, 4001) on duplicate key update y = y+1;
|
||||
insert into t1(x, y) values(4, 4444) on duplicate key update y = y+1;
|
||||
select x, y from t1 for system_time between timestamp '0-0-0 0:0:0' and timestamp '9999-1-1 0:0:0';
|
||||
select x, y from t1;
|
||||
drop table t1;
|
||||
end~~
|
||||
call test_01('timestamp(6)', 'myisam', 'sys_end');
|
||||
x y
|
||||
1 1000
|
||||
2 2000
|
||||
3 3001
|
||||
4 4002
|
||||
5 5000
|
||||
6 6000
|
||||
7 7000
|
||||
8 8000
|
||||
9 9000
|
||||
3 3000
|
||||
4 4000
|
||||
4 4001
|
||||
4 4444
|
||||
x y
|
||||
1 1000
|
||||
2 2000
|
||||
3 3001
|
||||
4 4002
|
||||
4 4444
|
||||
5 5000
|
||||
6 6000
|
||||
7 7000
|
||||
8 8000
|
||||
9 9000
|
||||
call test_01('bigint unsigned', 'innodb', 'commit_ts(sys_end)');
|
||||
x y
|
||||
1 1000
|
||||
2 2000
|
||||
3 3000
|
||||
3 3001
|
||||
4 4000
|
||||
4 4001
|
||||
4 4002
|
||||
4 4444
|
||||
5 5000
|
||||
6 6000
|
||||
7 7000
|
||||
8 8000
|
||||
9 9000
|
||||
x y
|
||||
1 1000
|
||||
2 2000
|
||||
3 3001
|
||||
4 4002
|
||||
4 4444
|
||||
5 5000
|
||||
6 6000
|
||||
7 7000
|
||||
8 8000
|
||||
9 9000
|
||||
drop procedure test_01;
|
||||
create procedure 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~~
|
||||
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
|
||||
drop procedure verify_vtq;
|
||||
|
|
|
@ -1056,206 +1056,3 @@ Note 1592 Unsafe statement written to the binary log using statement format sinc
|
|||
DROP TABLE table_11757486;
|
||||
SET SESSION SQL_MODE=default;
|
||||
end of 10.0 tests
|
||||
#
|
||||
# System Versioning Support
|
||||
#
|
||||
#
|
||||
set @@session.time_zone='+00:00';
|
||||
select ifnull(max(trx_id), 0) into @start_trx_id from information_schema.innodb_vtq;
|
||||
create procedure test_01(
|
||||
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);
|
||||
insert into t2(x, y) values
|
||||
(1, 1010),
|
||||
(2, 2010),
|
||||
(3, 3010),
|
||||
(4, 4010),
|
||||
(5, 5010),
|
||||
(6, 6010),
|
||||
(7, 7010),
|
||||
(8, 8010),
|
||||
(9, 9010);
|
||||
update t1, t2 set t1.y = t1.x + t1.y, t2.y = t2.x + t2.y where t1.x > 7 and t2.x < 7;
|
||||
select x, y from t1 for system_time between timestamp '0-0-0 0:0:0' and timestamp '9999-1-1 0:0:0';
|
||||
select x, y from t1;
|
||||
select x, y from t2 for system_time between timestamp '0-0-0 0:0:0' and timestamp '9999-1-1 0:0:0';
|
||||
select x, y from t2;
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
end~~
|
||||
call test_01('timestamp(6)', 'myisam', 'sys_end');
|
||||
x y
|
||||
1 1000
|
||||
2 2000
|
||||
3 3000
|
||||
4 4000
|
||||
5 5000
|
||||
6 6000
|
||||
7 7000
|
||||
8 8008
|
||||
9 9009
|
||||
8 8000
|
||||
9 9000
|
||||
x y
|
||||
1 1000
|
||||
2 2000
|
||||
3 3000
|
||||
4 4000
|
||||
5 5000
|
||||
6 6000
|
||||
7 7000
|
||||
8 8008
|
||||
9 9009
|
||||
x y
|
||||
1 1011
|
||||
2 2012
|
||||
3 3013
|
||||
4 4014
|
||||
5 5015
|
||||
6 6016
|
||||
7 7010
|
||||
8 8010
|
||||
9 9010
|
||||
1 1010
|
||||
2 2010
|
||||
3 3010
|
||||
4 4010
|
||||
5 5010
|
||||
6 6010
|
||||
x y
|
||||
1 1011
|
||||
2 2012
|
||||
3 3013
|
||||
4 4014
|
||||
5 5015
|
||||
6 6016
|
||||
7 7010
|
||||
8 8010
|
||||
9 9010
|
||||
call test_01('bigint unsigned', 'innodb', 'commit_ts(sys_end)');
|
||||
x y
|
||||
1 1000
|
||||
2 2000
|
||||
3 3000
|
||||
4 4000
|
||||
5 5000
|
||||
6 6000
|
||||
7 7000
|
||||
8 8008
|
||||
9 9009
|
||||
8 8000
|
||||
9 9000
|
||||
x y
|
||||
1 1000
|
||||
2 2000
|
||||
3 3000
|
||||
4 4000
|
||||
5 5000
|
||||
6 6000
|
||||
7 7000
|
||||
8 8008
|
||||
9 9009
|
||||
x y
|
||||
1 1011
|
||||
2 2012
|
||||
3 3013
|
||||
4 4014
|
||||
5 5015
|
||||
6 6016
|
||||
7 7010
|
||||
8 8010
|
||||
9 9010
|
||||
1 1010
|
||||
2 2010
|
||||
3 3010
|
||||
4 4010
|
||||
5 5010
|
||||
6 6010
|
||||
x y
|
||||
1 1011
|
||||
2 2012
|
||||
3 3013
|
||||
4 4014
|
||||
5 5015
|
||||
6 6016
|
||||
7 7010
|
||||
8 8010
|
||||
9 9010
|
||||
drop procedure test_01;
|
||||
create procedure 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~~
|
||||
call verify_vtq;
|
||||
No A B C D
|
||||
1 1 1 1 1
|
||||
2 1 1 1 1
|
||||
3 1 1 1 1
|
||||
drop procedure verify_vtq;
|
||||
CREATE TABLE t1 (
|
||||
id BIGINT PRIMARY KEY,
|
||||
name VARCHAR(128) WITH SYSTEM VERSIONING,
|
||||
salary BIGINT
|
||||
);
|
||||
INSERT INTO t1 VALUES (1, "Jeremy", 3000);
|
||||
CREATE TABLE t2 (
|
||||
id BIGINT PRIMARY KEY,
|
||||
name VARCHAR(128) WITH SYSTEM VERSIONING,
|
||||
salary BIGINT
|
||||
);
|
||||
INSERT INTO t2 VALUES (1, "Jeremy", 4000);
|
||||
SELECT sys_trx_start INTO @tmp1 FROM t1;
|
||||
SELECT sys_trx_start INTO @tmp2 FROM t2;
|
||||
UPDATE t1, t2 SET t1.name="Jerry", t2.name="Jerry" WHERE t1.id=t2.id AND t1.name="Jeremy";
|
||||
SELECT @tmp1 < sys_trx_start, name FROM t1;
|
||||
@tmp1 < sys_trx_start name
|
||||
1 Jerry
|
||||
SELECT @tmp2 < sys_trx_start, name FROM t2;
|
||||
@tmp2 < sys_trx_start name
|
||||
1 Jerry
|
||||
SELECT sys_trx_start INTO @tmp1 FROM t1;
|
||||
SELECT sys_trx_start INTO @tmp2 FROM t2;
|
||||
UPDATE t1, t2 SET t1.salary=2500, t2.salary=2500 WHERE t1.id=t2.id AND t1.name="Jerry";
|
||||
SELECT @tmp1 = sys_trx_start, salary FROM t1;
|
||||
@tmp1 = sys_trx_start salary
|
||||
1 2500
|
||||
SELECT @tmp2 = sys_trx_start, salary FROM t2;
|
||||
@tmp2 = sys_trx_start salary
|
||||
1 2500
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t2;
|
||||
|
|
|
@ -5548,68 +5548,3 @@ select (SELECT name FROM t1 WHERE name='tom' AND pw=PASSWORD(@undefined));
|
|||
NULL
|
||||
drop table t1;
|
||||
End of 10.0 tests
|
||||
#
|
||||
# System Versioning Support
|
||||
#
|
||||
#
|
||||
CREATE TABLE t1( x INT UNSIGNED, y INT UNSIGNED, Sys_start TIMESTAMP(6) GENERATED ALWAYS AS ROW START, Sys_end TIMESTAMP(6) GENERATED ALWAYS AS ROW END, PERIOD FOR SYSTEM_TIME (Sys_start, Sys_end)) WITH SYSTEM VERSIONING;
|
||||
INSERT INTO t1(x, y) VALUES
|
||||
(0, 100),
|
||||
(1, 101),
|
||||
(2, 102),
|
||||
(3, 103),
|
||||
(4, 104),
|
||||
(5, 105),
|
||||
(6, 106),
|
||||
(7, 107),
|
||||
(8, 108),
|
||||
(9, 109);
|
||||
DELETE FROM t1 WHERE x = 3;
|
||||
DELETE FROM t1 WHERE x > 7;
|
||||
INSERT INTO t1(x, y) VALUES(3, 33);
|
||||
SELECT @time := Sys_start FROM t1 WHERE x = 3 AND y = 33 FOR SYSTEM_TIME BETWEEN TIMESTAMP '0-0-0 0:0:0' AND TIMESTAMP '2038-01-19 04:14:07';
|
||||
@time := Sys_start
|
||||
Sys_start
|
||||
SELECT x, y FROM t1;
|
||||
x y
|
||||
0 100
|
||||
1 101
|
||||
2 102
|
||||
4 104
|
||||
5 105
|
||||
6 106
|
||||
7 107
|
||||
3 33
|
||||
SET @query=CONCAT('SELECT x, y FROM t1 FOR SYSTEM_TIME FROM TIMESTAMP \'0-0-0 0:0:0\' TO TIMESTAMP \'', @time, '\'');
|
||||
PREPARE stmt_t1 FROM @query;
|
||||
EXECUTE stmt_t1;
|
||||
x y
|
||||
0 100
|
||||
1 101
|
||||
2 102
|
||||
3 103
|
||||
4 104
|
||||
5 105
|
||||
6 106
|
||||
7 107
|
||||
8 108
|
||||
9 109
|
||||
SET @query=CONCAT('SELECT x, y FROM t1 FOR SYSTEM_TIME BETWEEN TIMESTAMP \'0-0-0 0:0:0\' AND TIMESTAMP \'', @time, '\'');
|
||||
PREPARE stmt_t1 FROM @query;
|
||||
EXECUTE stmt_t1;
|
||||
x y
|
||||
0 100
|
||||
1 101
|
||||
2 102
|
||||
3 103
|
||||
4 104
|
||||
5 105
|
||||
6 106
|
||||
7 107
|
||||
8 108
|
||||
9 109
|
||||
3 33
|
||||
SET @time=NULL;
|
||||
SET @query=NULL;
|
||||
DEALLOCATE PREPARE stmt_t1;
|
||||
DROP TABLE t1;
|
||||
|
|
|
@ -5559,71 +5559,6 @@ select (SELECT name FROM t1 WHERE name='tom' AND pw=PASSWORD(@undefined));
|
|||
NULL
|
||||
drop table t1;
|
||||
End of 10.0 tests
|
||||
#
|
||||
# System Versioning Support
|
||||
#
|
||||
#
|
||||
CREATE TABLE t1( x INT UNSIGNED, y INT UNSIGNED, Sys_start TIMESTAMP(6) GENERATED ALWAYS AS ROW START, Sys_end TIMESTAMP(6) GENERATED ALWAYS AS ROW END, PERIOD FOR SYSTEM_TIME (Sys_start, Sys_end)) WITH SYSTEM VERSIONING;
|
||||
INSERT INTO t1(x, y) VALUES
|
||||
(0, 100),
|
||||
(1, 101),
|
||||
(2, 102),
|
||||
(3, 103),
|
||||
(4, 104),
|
||||
(5, 105),
|
||||
(6, 106),
|
||||
(7, 107),
|
||||
(8, 108),
|
||||
(9, 109);
|
||||
DELETE FROM t1 WHERE x = 3;
|
||||
DELETE FROM t1 WHERE x > 7;
|
||||
INSERT INTO t1(x, y) VALUES(3, 33);
|
||||
SELECT @time := Sys_start FROM t1 WHERE x = 3 AND y = 33 FOR SYSTEM_TIME BETWEEN TIMESTAMP '0-0-0 0:0:0' AND TIMESTAMP '2038-01-19 04:14:07';
|
||||
@time := Sys_start
|
||||
Sys_start
|
||||
SELECT x, y FROM t1;
|
||||
x y
|
||||
0 100
|
||||
1 101
|
||||
2 102
|
||||
4 104
|
||||
5 105
|
||||
6 106
|
||||
7 107
|
||||
3 33
|
||||
SET @query=CONCAT('SELECT x, y FROM t1 FOR SYSTEM_TIME FROM TIMESTAMP \'0-0-0 0:0:0\' TO TIMESTAMP \'', @time, '\'');
|
||||
PREPARE stmt_t1 FROM @query;
|
||||
EXECUTE stmt_t1;
|
||||
x y
|
||||
0 100
|
||||
1 101
|
||||
2 102
|
||||
3 103
|
||||
4 104
|
||||
5 105
|
||||
6 106
|
||||
7 107
|
||||
8 108
|
||||
9 109
|
||||
SET @query=CONCAT('SELECT x, y FROM t1 FOR SYSTEM_TIME BETWEEN TIMESTAMP \'0-0-0 0:0:0\' AND TIMESTAMP \'', @time, '\'');
|
||||
PREPARE stmt_t1 FROM @query;
|
||||
EXECUTE stmt_t1;
|
||||
x y
|
||||
0 100
|
||||
1 101
|
||||
2 102
|
||||
3 103
|
||||
4 104
|
||||
5 105
|
||||
6 106
|
||||
7 107
|
||||
8 108
|
||||
9 109
|
||||
3 33
|
||||
SET @time=NULL;
|
||||
SET @query=NULL;
|
||||
DEALLOCATE PREPARE stmt_t1;
|
||||
DROP TABLE t1;
|
||||
set join_cache_level=default;
|
||||
show variables like 'join_cache_level';
|
||||
Variable_name Value
|
||||
|
|
|
@ -5548,68 +5548,3 @@ select (SELECT name FROM t1 WHERE name='tom' AND pw=PASSWORD(@undefined));
|
|||
NULL
|
||||
drop table t1;
|
||||
End of 10.0 tests
|
||||
#
|
||||
# System Versioning Support
|
||||
#
|
||||
#
|
||||
CREATE TABLE t1( x INT UNSIGNED, y INT UNSIGNED, Sys_start TIMESTAMP(6) GENERATED ALWAYS AS ROW START, Sys_end TIMESTAMP(6) GENERATED ALWAYS AS ROW END, PERIOD FOR SYSTEM_TIME (Sys_start, Sys_end)) WITH SYSTEM VERSIONING;
|
||||
INSERT INTO t1(x, y) VALUES
|
||||
(0, 100),
|
||||
(1, 101),
|
||||
(2, 102),
|
||||
(3, 103),
|
||||
(4, 104),
|
||||
(5, 105),
|
||||
(6, 106),
|
||||
(7, 107),
|
||||
(8, 108),
|
||||
(9, 109);
|
||||
DELETE FROM t1 WHERE x = 3;
|
||||
DELETE FROM t1 WHERE x > 7;
|
||||
INSERT INTO t1(x, y) VALUES(3, 33);
|
||||
SELECT @time := Sys_start FROM t1 WHERE x = 3 AND y = 33 FOR SYSTEM_TIME BETWEEN TIMESTAMP '0-0-0 0:0:0' AND TIMESTAMP '2038-01-19 04:14:07';
|
||||
@time := Sys_start
|
||||
Sys_start
|
||||
SELECT x, y FROM t1;
|
||||
x y
|
||||
0 100
|
||||
1 101
|
||||
2 102
|
||||
4 104
|
||||
5 105
|
||||
6 106
|
||||
7 107
|
||||
3 33
|
||||
SET @query=CONCAT('SELECT x, y FROM t1 FOR SYSTEM_TIME FROM TIMESTAMP \'0-0-0 0:0:0\' TO TIMESTAMP \'', @time, '\'');
|
||||
PREPARE stmt_t1 FROM @query;
|
||||
EXECUTE stmt_t1;
|
||||
x y
|
||||
0 100
|
||||
1 101
|
||||
2 102
|
||||
3 103
|
||||
4 104
|
||||
5 105
|
||||
6 106
|
||||
7 107
|
||||
8 108
|
||||
9 109
|
||||
SET @query=CONCAT('SELECT x, y FROM t1 FOR SYSTEM_TIME BETWEEN TIMESTAMP \'0-0-0 0:0:0\' AND TIMESTAMP \'', @time, '\'');
|
||||
PREPARE stmt_t1 FROM @query;
|
||||
EXECUTE stmt_t1;
|
||||
x y
|
||||
0 100
|
||||
1 101
|
||||
2 102
|
||||
3 103
|
||||
4 104
|
||||
5 105
|
||||
6 106
|
||||
7 107
|
||||
8 108
|
||||
9 109
|
||||
3 33
|
||||
SET @time=NULL;
|
||||
SET @query=NULL;
|
||||
DEALLOCATE PREPARE stmt_t1;
|
||||
DROP TABLE t1;
|
||||
|
|
|
@ -719,146 +719,3 @@ Handler_read_rnd_deleted 0
|
|||
Handler_read_rnd_next 0
|
||||
drop table t1, t2;
|
||||
# End of MariaDB 10.0 tests
|
||||
#
|
||||
# System Versioning Support
|
||||
#
|
||||
#
|
||||
set @@session.time_zone='+00:00';
|
||||
select ifnull(max(trx_id), 0) into @start_trx_id from information_schema.innodb_vtq;
|
||||
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
|
||||
(1, 1000),
|
||||
(2, 2000),
|
||||
(3, 3000),
|
||||
(4, 4000),
|
||||
(5, 5000),
|
||||
(6, 6000),
|
||||
(7, 7000),
|
||||
(8, 8000),
|
||||
(9, 9000);
|
||||
select x, y from t1;
|
||||
update t1 set y = y + 1 where x > 7;
|
||||
select x, y from t1;
|
||||
select x, y from t1 for system_time
|
||||
between timestamp '0000-0-0 0:0:0'
|
||||
and timestamp '2038-01-19 04:14:07';
|
||||
drop table t1;
|
||||
end~~
|
||||
call test_01('timestamp(6)', 'myisam', 'sys_end');
|
||||
x y
|
||||
1 1000
|
||||
2 2000
|
||||
3 3000
|
||||
4 4000
|
||||
5 5000
|
||||
6 6000
|
||||
7 7000
|
||||
8 8000
|
||||
9 9000
|
||||
x y
|
||||
1 1000
|
||||
2 2000
|
||||
3 3000
|
||||
4 4000
|
||||
5 5000
|
||||
6 6000
|
||||
7 7000
|
||||
8 8001
|
||||
9 9001
|
||||
x y
|
||||
1 1000
|
||||
2 2000
|
||||
3 3000
|
||||
4 4000
|
||||
5 5000
|
||||
6 6000
|
||||
7 7000
|
||||
8 8001
|
||||
9 9001
|
||||
8 8000
|
||||
9 9000
|
||||
call test_01('bigint unsigned', 'innodb', 'commit_ts(sys_end)');
|
||||
x y
|
||||
1 1000
|
||||
2 2000
|
||||
3 3000
|
||||
4 4000
|
||||
5 5000
|
||||
6 6000
|
||||
7 7000
|
||||
8 8000
|
||||
9 9000
|
||||
x y
|
||||
1 1000
|
||||
2 2000
|
||||
3 3000
|
||||
4 4000
|
||||
5 5000
|
||||
6 6000
|
||||
7 7000
|
||||
8 8001
|
||||
9 9001
|
||||
x y
|
||||
1 1000
|
||||
2 2000
|
||||
3 3000
|
||||
4 4000
|
||||
5 5000
|
||||
6 6000
|
||||
7 7000
|
||||
8 8001
|
||||
9 9001
|
||||
8 8000
|
||||
9 9000
|
||||
drop procedure test_01;
|
||||
create procedure 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~~
|
||||
call verify_vtq;
|
||||
No A B C D
|
||||
1 1 1 1 1
|
||||
2 1 1 1 1
|
||||
drop procedure verify_vtq;
|
||||
CREATE TABLE t1 (
|
||||
id BIGINT PRIMARY KEY,
|
||||
A INT,
|
||||
B INT WITHOUT SYSTEM VERSIONING
|
||||
) WITH SYSTEM VERSIONING;
|
||||
INSERT INTO t1 VALUES(1, 1, 1);
|
||||
SELECT sys_trx_start INTO @tmp1 FROM t1;
|
||||
UPDATE t1 SET A=11, B=11 WHERE id=1;
|
||||
SELECT @tmp1 < sys_trx_start, A, B FROM t1;
|
||||
@tmp1 < sys_trx_start A B
|
||||
1 11 11
|
||||
SELECT sys_trx_start INTO @tmp1 FROM t1;
|
||||
UPDATE t1 SET B=1 WHERE id=1;
|
||||
SELECT @tmp1 = sys_trx_start, B FROM t1;
|
||||
@tmp1 = sys_trx_start B
|
||||
1 1
|
||||
DROP TABLE t1;
|
||||
|
|
|
@ -397,37 +397,3 @@ insert into t1 values(null);
|
|||
select last_insert_id();
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
|
||||
--echo #
|
||||
--echo # System Versioning Support
|
||||
--echo #
|
||||
--echo #
|
||||
CREATE TABLE t1(id INT UNSIGNED AUTO_INCREMENT, x INT UNSIGNED, y INT UNSIGNED, Sys_start TIMESTAMP(6) GENERATED ALWAYS AS ROW START, Sys_end TIMESTAMP(6) GENERATED ALWAYS AS ROW END, PERIOD FOR SYSTEM_TIME (Sys_start, Sys_end), PRIMARY KEY (id)) WITH SYSTEM VERSIONING;
|
||||
CREATE TABLE T1(id INT UNSIGNED AUTO_INCREMENT, x INT UNSIGNED, y INT UNSIGNED, PRIMARY KEY (id));
|
||||
INSERT INTO t1(x, y) VALUES(1, 11);
|
||||
INSERT INTO T1(x, y) VALUES(1, 11);
|
||||
INSERT INTO t1(x, y) VALUES(2, 12);
|
||||
INSERT INTO T1(x, y) VALUES(2, 12);
|
||||
INSERT INTO t1(x, y) VALUES(3, 13);
|
||||
INSERT INTO T1(x, y) VALUES(3, 13);
|
||||
INSERT INTO t1(x, y) VALUES(4, 14);
|
||||
INSERT INTO T1(x, y) VALUES(4, 14);
|
||||
INSERT INTO t1(x, y) VALUES(5, 15);
|
||||
INSERT INTO T1(x, y) VALUES(5, 15);
|
||||
INSERT INTO t1(x, y) VALUES(6, 16);
|
||||
INSERT INTO T1(x, y) VALUES(6, 16);
|
||||
INSERT INTO t1(x, y) VALUES(7, 17);
|
||||
INSERT INTO T1(x, y) VALUES(7, 17);
|
||||
INSERT INTO t1(x, y) VALUES(8, 18);
|
||||
INSERT INTO T1(x, y) VALUES(8, 18);
|
||||
INSERT INTO t1(x, y) VALUES(9, 19);
|
||||
INSERT INTO T1(x, y) VALUES(9, 19);
|
||||
SELECT t1.x = T1.x AND t1.y = T1.y, t1.x, t1.y, T1.x, T1.y FROM t1 INNER JOIN T1 ON(t1.id = T1.id);
|
||||
DELETE FROM t1 WHERE x=2;
|
||||
DELETE FROM T1 WHERE x=2;
|
||||
SELECT t1.x = T1.x AND t1.y = T1.y, t1.x, t1.y, T1.x, T1.y FROM t1 INNER JOIN T1 ON(t1.id = T1.id);
|
||||
DELETE FROM t1 WHERE x>7;
|
||||
DELETE FROM T1 WHERE x>7;
|
||||
SELECT t1.x = T1.x AND t1.y = T1.y, t1.x, t1.y, T1.x, T1.y FROM t1 INNER JOIN T1 ON(t1.id = T1.id);
|
||||
DROP TABLE t1;
|
||||
DROP TABLE T1;
|
||||
|
|
|
@ -1781,160 +1781,3 @@ create table t1;
|
|||
#
|
||||
create table t1 (i int, j int, key(i), key(i)) as select 1 as i, 2 as j;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Create table SYSTEM VERSIONING
|
||||
#
|
||||
--echo #
|
||||
--echo # Test for SYSTEM VERSIONING CREATE
|
||||
--echo #
|
||||
|
||||
create table t1 (
|
||||
XNo INT UNSIGNED,
|
||||
Sys_start TIMESTAMP(6) GENERATED ALWAYS AS ROW START,
|
||||
Sys_end TIMESTAMP(6) GENERATED ALWAYS AS ROW END,
|
||||
PERIOD FOR SYSTEM_TIME (Sys_start, Sys_end)
|
||||
) WITH SYSTEM VERSIONING;
|
||||
SHOW CREATE TABLE t1;
|
||||
|
||||
drop table if exists t1;
|
||||
|
||||
--echo # Versioning fields are set implicitly.
|
||||
create table t1 (
|
||||
XNo INT UNSIGNED
|
||||
) WITH SYSTEM VERSIONING;
|
||||
SHOW CREATE TABLE t1;
|
||||
|
||||
drop table if exists t1;
|
||||
|
||||
--error ER_SYS_START_MORE_THAN_ONCE
|
||||
create table t1 (
|
||||
XNo INT UNSIGNED,
|
||||
Sys_start TIMESTAMP(6) GENERATED ALWAYS AS ROW START,
|
||||
Sys_start2 TIMESTAMP(6) GENERATED ALWAYS AS ROW START,
|
||||
Sys_end TIMESTAMP(6) GENERATED ALWAYS AS ROW END,
|
||||
PERIOD FOR SYSTEM_TIME (Sys_start, Sys_end)
|
||||
) WITH SYSTEM VERSIONING;
|
||||
|
||||
--error ER_PERIOD_FOR_SYSTEM_TIME_CONTAINS_WRONG_END_COLUMN
|
||||
create table t1 (
|
||||
XNo INT UNSIGNED,
|
||||
Sys_start TIMESTAMP(6) GENERATED ALWAYS AS ROW START,
|
||||
Sys_end2 TIMESTAMP(6) GENERATED ALWAYS AS ROW END,
|
||||
PERIOD FOR SYSTEM_TIME (Sys_start, Sys_end)
|
||||
) WITH SYSTEM VERSIONING;
|
||||
|
||||
--error ER_SYS_END_MORE_THAN_ONCE
|
||||
create table t1 (
|
||||
XNo INT UNSIGNED,
|
||||
Sys_start TIMESTAMP(6) GENERATED ALWAYS AS ROW START,
|
||||
Sys_end TIMESTAMP(6) GENERATED ALWAYS AS ROW END,
|
||||
Sys_end2 TIMESTAMP(6) GENERATED ALWAYS AS ROW END,
|
||||
PERIOD FOR SYSTEM_TIME (Sys_start, Sys_end)
|
||||
) WITH SYSTEM VERSIONING;
|
||||
|
||||
--error ER_SYS_START_NOT_SPECIFIED
|
||||
create table t1 (
|
||||
XNo INT UNSIGNED,
|
||||
PERIOD FOR SYSTEM_TIME (Sys_start, Sys_end)
|
||||
) WITH SYSTEM VERSIONING;
|
||||
|
||||
--error ER_SYS_END_MORE_THAN_ONCE
|
||||
create table t1 (
|
||||
XNo INT UNSIGNED,
|
||||
Sys_start TIMESTAMP(6) GENERATED ALWAYS AS ROW START,
|
||||
Sys_end TIMESTAMP(6) GENERATED ALWAYS AS ROW END,
|
||||
Sys_end2 TIMESTAMP(6) GENERATED ALWAYS AS ROW END,
|
||||
PERIOD FOR SYSTEM_TIME (Sys_start, Sys_end)
|
||||
);
|
||||
|
||||
--error ER_PERIOD_FOR_SYSTEM_TIME_CONTAINS_WRONG_START_COLUMN
|
||||
create table t1 (
|
||||
XNo INT UNSIGNED,
|
||||
Sys_start TIMESTAMP(6) GENERATED ALWAYS AS ROW START,
|
||||
Sys_end TIMESTAMP(6) GENERATED ALWAYS AS ROW END,
|
||||
PERIOD FOR SYSTEM_TIME (Sys_insert, Sys_remove)
|
||||
) WITH SYSTEM VERSIONING;
|
||||
|
||||
--error ER_MISSING_WITH_SYSTEM_VERSIONING
|
||||
create table t1 (
|
||||
XNo INT UNSIGNED,
|
||||
Sys_start TIMESTAMP(6) GENERATED ALWAYS AS ROW START,
|
||||
Sys_end TIMESTAMP(6) GENERATED ALWAYS AS ROW END,
|
||||
PERIOD FOR SYSTEM_TIME (Sys_start, Sys_end)
|
||||
);
|
||||
|
||||
--error ER_SYS_START_AND_SYS_END_SAME
|
||||
create table t1 (
|
||||
XNo INT UNSIGNED,
|
||||
Sys_start TIMESTAMP(6) GENERATED ALWAYS AS ROW START,
|
||||
Sys_end TIMESTAMP(6) GENERATED ALWAYS AS ROW END,
|
||||
PERIOD FOR SYSTEM_TIME (Sys_start, Sys_start)
|
||||
);
|
||||
|
||||
--error ER_SYS_START_FIELD_MUST_BE_TIMESTAMP
|
||||
create table t1 (
|
||||
XNo INT UNSIGNED,
|
||||
Sys_start INT GENERATED ALWAYS AS ROW START,
|
||||
Sys_end TIMESTAMP(6) GENERATED ALWAYS AS ROW END,
|
||||
PERIOD FOR SYSTEM_TIME (Sys_start, Sys_end)
|
||||
) WITH SYSTEM VERSIONING;
|
||||
|
||||
--error ER_SYS_END_FIELD_MUST_BE_TIMESTAMP
|
||||
create table t1 (
|
||||
XNo INT UNSIGNED,
|
||||
Sys_start TIMESTAMP(6) GENERATED ALWAYS AS ROW START,
|
||||
Sys_end INT GENERATED ALWAYS AS ROW END,
|
||||
PERIOD FOR SYSTEM_TIME (Sys_start, Sys_end)
|
||||
) WITH SYSTEM VERSIONING;
|
||||
|
||||
CREATE TABLE t1 (
|
||||
A INT WITH SYSTEM VERSIONING,
|
||||
B INT
|
||||
);
|
||||
SHOW CREATE TABLE t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (
|
||||
A INT WITH SYSTEM VERSIONING,
|
||||
B INT
|
||||
) WITH SYSTEM VERSIONING;
|
||||
SHOW CREATE TABLE t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
--error ER_NO_VERSIONED_FIELDS_IN_VERSIONED_TABLE
|
||||
CREATE TABLE t1 (
|
||||
A INT,
|
||||
B INT WITHOUT SYSTEM VERSIONING
|
||||
);
|
||||
|
||||
CREATE TABLE t1 (
|
||||
A INT,
|
||||
B INT WITHOUT SYSTEM VERSIONING
|
||||
) WITH SYSTEM VERSIONING;
|
||||
SHOW CREATE TABLE t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (
|
||||
A INT WITH SYSTEM VERSIONING,
|
||||
B INT WITHOUT SYSTEM VERSIONING
|
||||
);
|
||||
SHOW CREATE TABLE t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (
|
||||
A INT WITH SYSTEM VERSIONING,
|
||||
B INT WITHOUT SYSTEM VERSIONING
|
||||
) WITH SYSTEM VERSIONING;
|
||||
SHOW CREATE TABLE t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
--error ER_NO_VERSIONED_FIELDS_IN_VERSIONED_TABLE
|
||||
CREATE TABLE t1 (
|
||||
A INT WITHOUT SYSTEM VERSIONING
|
||||
);
|
||||
|
||||
--error ER_NO_VERSIONED_FIELDS_IN_VERSIONED_TABLE
|
||||
CREATE TABLE t1 (
|
||||
A INT WITHOUT SYSTEM VERSIONING
|
||||
) WITH SYSTEM VERSIONING;
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
--loose-innodb-vtq
|
|
@ -582,88 +582,3 @@ DELETE v2 FROM v2;
|
|||
|
||||
DROP VIEW v2, v1;
|
||||
DROP TABLE t1, t2;
|
||||
|
||||
#
|
||||
# SQL DELETE for SYSTEM VERSIONING
|
||||
#
|
||||
--echo #
|
||||
--echo # System Versioning Support
|
||||
--echo #
|
||||
--echo #
|
||||
|
||||
-- source include/have_innodb.inc
|
||||
set @@session.time_zone='+00:00';
|
||||
select ifnull(max(trx_id), 0) into @start_trx_id from information_schema.innodb_vtq;
|
||||
|
||||
delimiter ~~;
|
||||
create procedure test_01(
|
||||
sys_type varchar(255),
|
||||
engine varchar(255),
|
||||
fields varchar(255))
|
||||
begin
|
||||
set @str= concat('
|
||||
create table t1(
|
||||
XNo 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(XNo) values(0);
|
||||
insert into t1(XNo) values(1);
|
||||
insert into t1(XNo) values(2);
|
||||
insert into t1(XNo) values(3);
|
||||
insert into t1(XNo) values(4);
|
||||
insert into t1(XNo) values(5);
|
||||
insert into t1(XNo) values(6);
|
||||
insert into t1(XNo) values(7);
|
||||
insert into t1(XNo) values(8);
|
||||
insert into t1(XNo) values(9);
|
||||
set @str= concat('select XNo, ',
|
||||
fields, " < '2038-01-19 03:14:07'
|
||||
from t1 for system_time
|
||||
between timestamp '0000-0-0 0:0:0'
|
||||
and timestamp '2038-01-19 04:14:07'");
|
||||
prepare stmt from @str; execute stmt;
|
||||
delete from t1 where XNo = 0;
|
||||
execute stmt;
|
||||
delete from t1 where XNo = 1;
|
||||
execute stmt;
|
||||
delete from t1 where XNo > 5;
|
||||
create view vt1 as select XNo from t1;
|
||||
select XNo from vt1;
|
||||
delete from vt1 where XNo = 3;
|
||||
select XNo from vt1;
|
||||
execute stmt; drop prepare stmt;
|
||||
drop view vt1;
|
||||
drop table t1;
|
||||
end~~
|
||||
delimiter ;~~
|
||||
|
||||
call test_01('timestamp(6)', 'myisam', 'sys_end');
|
||||
call test_01('bigint unsigned', 'innodb', 'commit_ts(sys_end)');
|
||||
drop procedure test_01;
|
||||
|
||||
# VTQ test
|
||||
|
||||
delimiter ~~;
|
||||
create procedure 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~~
|
||||
delimiter ;~~
|
||||
|
||||
call verify_vtq;
|
||||
drop procedure verify_vtq;
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
--loose-innodb-vtq
|
|
@ -573,186 +573,3 @@ insert ignore into t1 values (1,12) on duplicate key update f2=13;
|
|||
set @@old_mode="";
|
||||
insert ignore into t1 values (1,12);
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
--echo # System Versioning Support
|
||||
--echo #
|
||||
--echo #
|
||||
|
||||
-- source include/have_innodb.inc
|
||||
set @@session.time_zone='+00:00';
|
||||
select ifnull(max(trx_id), 0) into @start_trx_id from information_schema.innodb_vtq;
|
||||
|
||||
delimiter ~~;
|
||||
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~~
|
||||
delimiter ;~~
|
||||
|
||||
call test_01('timestamp(6)', 'myisam', 'sys_end');
|
||||
call test_01('bigint unsigned', 'innodb', 'commit_ts(sys_end)');
|
||||
drop procedure test_01;
|
||||
|
||||
delimiter ~~;
|
||||
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~~
|
||||
delimiter ;~~
|
||||
|
||||
call test_02('timestamp(6)', 'myisam', 'sys_end');
|
||||
call test_02('bigint unsigned', 'innodb', 'commit_ts(sys_end)');
|
||||
drop procedure test_02;
|
||||
|
||||
delimiter ~~;
|
||||
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~~
|
||||
delimiter ;~~
|
||||
|
||||
call test_03('timestamp(6)', 'myisam', 'sys_end');
|
||||
--ERROR ER_GENERATED_FIELD_CANNOT_BE_SET_BY_USER
|
||||
insert into t1(x, y, sys_end) values(8001, 9001, '2015-1-1 1:1:1');
|
||||
--ERROR ER_GENERATED_FIELD_CANNOT_BE_SET_BY_USER
|
||||
insert into vt1_2 values(3002, 4002, '2015-2-2 2:2:2');
|
||||
drop table t1;
|
||||
drop view vt1_1;
|
||||
drop view vt1_2;
|
||||
|
||||
call test_03('bigint unsigned', 'innodb', 'commit_ts(sys_end)');
|
||||
--ERROR ER_GENERATED_FIELD_CANNOT_BE_SET_BY_USER
|
||||
insert into t1(x, y, sys_end) values(8001, 9001, 1111111);
|
||||
--ERROR ER_GENERATED_FIELD_CANNOT_BE_SET_BY_USER
|
||||
insert into vt1_2 values(3002, 4002, 2222222);
|
||||
drop table t1;
|
||||
drop view vt1_1;
|
||||
drop view vt1_2;
|
||||
drop procedure test_03;
|
||||
|
||||
# VTQ test
|
||||
|
||||
delimiter ~~;
|
||||
create procedure 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~~
|
||||
delimiter ;~~
|
||||
|
||||
call verify_vtq;
|
||||
|
||||
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;
|
||||
|
||||
start transaction;
|
||||
insert into t2(x) values(1);
|
||||
savepoint a;
|
||||
insert into t1(x) values(1);
|
||||
rollback to a;
|
||||
commit;
|
||||
call verify_vtq;
|
||||
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
drop procedure verify_vtq;
|
||||
|
||||
# Check whether it is possible to insert rows in a versioned table
|
||||
# with implicit fields without crash.
|
||||
CREATE TABLE t1(
|
||||
id BIGINT PRIMARY KEY,
|
||||
A INT,
|
||||
B INT
|
||||
) WITH SYSTEM VERSIONING;
|
||||
INSERT INTO t1 VALUES(1, 1, 1);
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1(
|
||||
id BIGINT PRIMARY KEY,
|
||||
A INT,
|
||||
B INT
|
||||
) WITH SYSTEM VERSIONING ENGINE=INNODB;
|
||||
INSERT INTO t1 VALUES(1, 1, 1);
|
||||
DROP TABLE t1;
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
--loose-innodb-vtq
|
|
@ -425,86 +425,3 @@ SET GLOBAL myisam_data_pointer_size = @old_myisam_data_pointer_size;
|
|||
DROP TABLE t1;
|
||||
|
||||
--echo End of 5.1 tests
|
||||
|
||||
--echo #
|
||||
--echo # System Versioning Support
|
||||
--echo #
|
||||
--echo #
|
||||
|
||||
-- source include/have_innodb.inc
|
||||
set @@session.time_zone='+00:00';
|
||||
select ifnull(max(trx_id), 0) into @start_trx_id from information_schema.innodb_vtq;
|
||||
|
||||
delimiter ~~;
|
||||
create procedure test_01(
|
||||
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~~
|
||||
delimiter ;~~
|
||||
|
||||
call test_01('timestamp(6)', 'myisam', 'sys_end');
|
||||
call test_01('bigint unsigned', 'innodb', 'commit_ts(sys_end)');
|
||||
drop procedure test_01;
|
||||
|
||||
# VTQ test
|
||||
|
||||
delimiter ~~;
|
||||
create procedure 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~~
|
||||
delimiter ;~~
|
||||
|
||||
call verify_vtq;
|
||||
drop procedure verify_vtq;
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
--loose-innodb-vtq
|
|
@ -311,76 +311,3 @@ insert into t1(f1) values(1) on duplicate key update f1=1;
|
|||
select @stamp2:=f2 from t1;
|
||||
select if( @stamp1 = @stamp2, "correct", "wrong");
|
||||
drop table t1;
|
||||
|
||||
--echo #
|
||||
--echo # System Versioning Support
|
||||
--echo #
|
||||
--echo #
|
||||
|
||||
-- source include/have_innodb.inc
|
||||
set @@session.time_zone='+00:00';
|
||||
select ifnull(max(trx_id), 0) into @start_trx_id from information_schema.innodb_vtq;
|
||||
|
||||
delimiter ~~;
|
||||
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),
|
||||
primary key(x, y))
|
||||
with system versioning
|
||||
engine ', engine);
|
||||
prepare stmt from @str; 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);
|
||||
insert into t1(x, y) values(3, 3000) on duplicate key update y = y+1;
|
||||
insert into t1(x, y) values(4, 4000) on duplicate key update y = y+1;
|
||||
insert into t1(x, y) values(4, 4001) on duplicate key update y = y+1;
|
||||
insert into t1(x, y) values(4, 4444) on duplicate key update y = y+1;
|
||||
select x, y from t1 for system_time between timestamp '0-0-0 0:0:0' and timestamp '9999-1-1 0:0:0';
|
||||
select x, y from t1;
|
||||
drop table t1;
|
||||
end~~
|
||||
delimiter ;~~
|
||||
|
||||
call test_01('timestamp(6)', 'myisam', 'sys_end');
|
||||
call test_01('bigint unsigned', 'innodb', 'commit_ts(sys_end)');
|
||||
drop procedure test_01;
|
||||
|
||||
# VTQ test
|
||||
|
||||
delimiter ~~;
|
||||
create procedure 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~~
|
||||
delimiter ;~~
|
||||
|
||||
call verify_vtq;
|
||||
drop procedure verify_vtq;
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
--loose-innodb-vtq
|
|
@ -986,7 +986,7 @@ drop table t1,t2,t3;
|
|||
--echo end of 5.5 tests
|
||||
|
||||
|
||||
#--source include/have_xtradb.inc
|
||||
--source include/have_xtradb.inc
|
||||
|
||||
--echo
|
||||
--echo # Bug mdev-5970
|
||||
|
@ -1035,116 +1035,3 @@ DROP TABLE table_11757486;
|
|||
SET SESSION SQL_MODE=default;
|
||||
|
||||
--echo end of 10.0 tests
|
||||
|
||||
--echo #
|
||||
--echo # System Versioning Support
|
||||
--echo #
|
||||
--echo #
|
||||
|
||||
-- source include/have_innodb.inc
|
||||
set @@session.time_zone='+00:00';
|
||||
select ifnull(max(trx_id), 0) into @start_trx_id from information_schema.innodb_vtq;
|
||||
|
||||
delimiter ~~;
|
||||
create procedure test_01(
|
||||
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);
|
||||
insert into t2(x, y) values
|
||||
(1, 1010),
|
||||
(2, 2010),
|
||||
(3, 3010),
|
||||
(4, 4010),
|
||||
(5, 5010),
|
||||
(6, 6010),
|
||||
(7, 7010),
|
||||
(8, 8010),
|
||||
(9, 9010);
|
||||
update t1, t2 set t1.y = t1.x + t1.y, t2.y = t2.x + t2.y where t1.x > 7 and t2.x < 7;
|
||||
select x, y from t1 for system_time between timestamp '0-0-0 0:0:0' and timestamp '9999-1-1 0:0:0';
|
||||
select x, y from t1;
|
||||
select x, y from t2 for system_time between timestamp '0-0-0 0:0:0' and timestamp '9999-1-1 0:0:0';
|
||||
select x, y from t2;
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
end~~
|
||||
delimiter ;~~
|
||||
|
||||
call test_01('timestamp(6)', 'myisam', 'sys_end');
|
||||
call test_01('bigint unsigned', 'innodb', 'commit_ts(sys_end)');
|
||||
drop procedure test_01;
|
||||
|
||||
# VTQ test
|
||||
|
||||
delimiter ~~;
|
||||
create procedure 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~~
|
||||
delimiter ;~~
|
||||
|
||||
call verify_vtq;
|
||||
drop procedure verify_vtq;
|
||||
|
||||
CREATE TABLE t1 (
|
||||
id BIGINT PRIMARY KEY,
|
||||
name VARCHAR(128) WITH SYSTEM VERSIONING,
|
||||
salary BIGINT
|
||||
);
|
||||
INSERT INTO t1 VALUES (1, "Jeremy", 3000);
|
||||
|
||||
CREATE TABLE t2 (
|
||||
id BIGINT PRIMARY KEY,
|
||||
name VARCHAR(128) WITH SYSTEM VERSIONING,
|
||||
salary BIGINT
|
||||
);
|
||||
INSERT INTO t2 VALUES (1, "Jeremy", 4000);
|
||||
|
||||
SELECT sys_trx_start INTO @tmp1 FROM t1;
|
||||
SELECT sys_trx_start INTO @tmp2 FROM t2;
|
||||
UPDATE t1, t2 SET t1.name="Jerry", t2.name="Jerry" WHERE t1.id=t2.id AND t1.name="Jeremy";
|
||||
SELECT @tmp1 < sys_trx_start, name FROM t1;
|
||||
SELECT @tmp2 < sys_trx_start, name FROM t2;
|
||||
|
||||
SELECT sys_trx_start INTO @tmp1 FROM t1;
|
||||
SELECT sys_trx_start INTO @tmp2 FROM t2;
|
||||
UPDATE t1, t2 SET t1.salary=2500, t2.salary=2500 WHERE t1.id=t2.id AND t1.name="Jerry";
|
||||
SELECT @tmp1 = sys_trx_start, salary FROM t1;
|
||||
SELECT @tmp2 = sys_trx_start, salary FROM t2;
|
||||
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t2;
|
||||
|
|
|
@ -4671,37 +4671,3 @@ select (SELECT name FROM t1 WHERE name='tom' AND pw=PASSWORD(@undefined));
|
|||
drop table t1;
|
||||
|
||||
--echo End of 10.0 tests
|
||||
|
||||
--echo #
|
||||
--echo # System Versioning Support
|
||||
--echo #
|
||||
--echo #
|
||||
CREATE TABLE t1( x INT UNSIGNED, y INT UNSIGNED, Sys_start TIMESTAMP(6) GENERATED ALWAYS AS ROW START, Sys_end TIMESTAMP(6) GENERATED ALWAYS AS ROW END, PERIOD FOR SYSTEM_TIME (Sys_start, Sys_end)) WITH SYSTEM VERSIONING;
|
||||
INSERT INTO t1(x, y) VALUES
|
||||
(0, 100),
|
||||
(1, 101),
|
||||
(2, 102),
|
||||
(3, 103),
|
||||
(4, 104),
|
||||
(5, 105),
|
||||
(6, 106),
|
||||
(7, 107),
|
||||
(8, 108),
|
||||
(9, 109);
|
||||
DELETE FROM t1 WHERE x = 3;
|
||||
DELETE FROM t1 WHERE x > 7;
|
||||
--real_sleep 1
|
||||
INSERT INTO t1(x, y) VALUES(3, 33);
|
||||
--replace_column 1 Sys_start
|
||||
SELECT @time := Sys_start FROM t1 WHERE x = 3 AND y = 33 FOR SYSTEM_TIME BETWEEN TIMESTAMP '0-0-0 0:0:0' AND TIMESTAMP '2038-01-19 04:14:07';
|
||||
SELECT x, y FROM t1;
|
||||
SET @query=CONCAT('SELECT x, y FROM t1 FOR SYSTEM_TIME FROM TIMESTAMP \'0-0-0 0:0:0\' TO TIMESTAMP \'', @time, '\'');
|
||||
PREPARE stmt_t1 FROM @query;
|
||||
EXECUTE stmt_t1;
|
||||
SET @query=CONCAT('SELECT x, y FROM t1 FOR SYSTEM_TIME BETWEEN TIMESTAMP \'0-0-0 0:0:0\' AND TIMESTAMP \'', @time, '\'');
|
||||
PREPARE stmt_t1 FROM @query;
|
||||
EXECUTE stmt_t1;
|
||||
SET @time=NULL;
|
||||
SET @query=NULL;
|
||||
DEALLOCATE PREPARE stmt_t1;
|
||||
DROP TABLE t1;
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
--loose-innodb-vtq
|
|
@ -654,93 +654,3 @@ show status like 'Handler_read%';
|
|||
drop table t1, t2;
|
||||
|
||||
--echo # End of MariaDB 10.0 tests
|
||||
|
||||
--echo #
|
||||
--echo # System Versioning Support
|
||||
--echo #
|
||||
--echo #
|
||||
|
||||
-- source include/have_innodb.inc
|
||||
set @@session.time_zone='+00:00';
|
||||
select ifnull(max(trx_id), 0) into @start_trx_id from information_schema.innodb_vtq;
|
||||
|
||||
delimiter ~~;
|
||||
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
|
||||
(1, 1000),
|
||||
(2, 2000),
|
||||
(3, 3000),
|
||||
(4, 4000),
|
||||
(5, 5000),
|
||||
(6, 6000),
|
||||
(7, 7000),
|
||||
(8, 8000),
|
||||
(9, 9000);
|
||||
select x, y from t1;
|
||||
update t1 set y = y + 1 where x > 7;
|
||||
select x, y from t1;
|
||||
select x, y from t1 for system_time
|
||||
between timestamp '0000-0-0 0:0:0'
|
||||
and timestamp '2038-01-19 04:14:07';
|
||||
drop table t1;
|
||||
end~~
|
||||
delimiter ;~~
|
||||
|
||||
call test_01('timestamp(6)', 'myisam', 'sys_end');
|
||||
call test_01('bigint unsigned', 'innodb', 'commit_ts(sys_end)');
|
||||
drop procedure test_01;
|
||||
|
||||
# VTQ test
|
||||
|
||||
delimiter ~~;
|
||||
create procedure 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~~
|
||||
delimiter ;~~
|
||||
|
||||
call verify_vtq;
|
||||
drop procedure verify_vtq;
|
||||
|
||||
CREATE TABLE t1 (
|
||||
id BIGINT PRIMARY KEY,
|
||||
A INT,
|
||||
B INT WITHOUT SYSTEM VERSIONING
|
||||
) WITH SYSTEM VERSIONING;
|
||||
|
||||
INSERT INTO t1 VALUES(1, 1, 1);
|
||||
|
||||
SELECT sys_trx_start INTO @tmp1 FROM t1;
|
||||
UPDATE t1 SET A=11, B=11 WHERE id=1;
|
||||
SELECT @tmp1 < sys_trx_start, A, B FROM t1;
|
||||
|
||||
SELECT sys_trx_start INTO @tmp1 FROM t1;
|
||||
UPDATE t1 SET B=1 WHERE id=1;
|
||||
SELECT @tmp1 = sys_trx_start, B FROM t1;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
|
Loading…
Add table
Reference in a new issue