mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
@ -1,215 +1,264 @@
|
||||
-- source include/have_innodb.inc
|
||||
-- source suite/versioning/common.inc
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
|
||||
create table t1 (
|
||||
XNo int unsigned,
|
||||
Sys_start timestamp(6) generated always as row start,
|
||||
Sys_end timestamp(6) generated always as row end,
|
||||
--let $sys_datatype= `select sys_datatype()`
|
||||
|
||||
--replace_result "bigint unsigned" SYS_TRX_TYPE timestamp(6) SYS_TRX_TYPE
|
||||
eval create table t1 (
|
||||
x1 int unsigned,
|
||||
Sys_start $sys_datatype generated always as row start,
|
||||
Sys_end $sys_datatype generated always as row end,
|
||||
period for system_time (Sys_start, Sys_end)
|
||||
) with system versioning;
|
||||
--replace_result InnoDB INNODB_OR_MYISAM MyISAM INNODB_OR_MYISAM "bigint(20) unsigned" SYS_TRX_TYPE timestamp(6) SYS_TRX_TYPE
|
||||
show create table t1;
|
||||
|
||||
--echo # Implicit fields test
|
||||
create or replace table t1 (
|
||||
XNo int unsigned
|
||||
x2 int unsigned
|
||||
) with system versioning;
|
||||
--replace_result InnoDB INNODB_OR_MYISAM MyISAM INNODB_OR_MYISAM "bigint(20) unsigned" SYS_TRX_TYPE timestamp(6) SYS_TRX_TYPE
|
||||
show create table t1;
|
||||
|
||||
--replace_result "bigint unsigned" SYS_TRX_TYPE timestamp(6) SYS_TRX_TYPE
|
||||
--error ER_VERS_WRONG_PARAMS
|
||||
create or replace 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,
|
||||
eval create or replace table t1 (
|
||||
x3 int unsigned,
|
||||
Sys_start $sys_datatype generated always as row start,
|
||||
Sys_start2 $sys_datatype generated always as row start,
|
||||
Sys_end $sys_datatype generated always as row end,
|
||||
period for system_time (Sys_start, Sys_end)
|
||||
) with system versioning;
|
||||
|
||||
--replace_result "bigint unsigned" SYS_TRX_TYPE timestamp(6) SYS_TRX_TYPE
|
||||
--error ER_VERS_WRONG_PARAMS
|
||||
eval create or replace table t1 (
|
||||
x4 int unsigned,
|
||||
Sys_start $sys_datatype generated always as row start,
|
||||
Sys_end2 $sys_datatype generated always as row end,
|
||||
period for system_time (Sys_start, Sys_end)
|
||||
) with system versioning;
|
||||
|
||||
--replace_result "bigint unsigned" SYS_TRX_TYPE timestamp(6) SYS_TRX_TYPE
|
||||
--error ER_VERS_WRONG_PARAMS
|
||||
eval create or replace table t1 (
|
||||
x5 int unsigned,
|
||||
Sys_start $sys_datatype generated always as row start,
|
||||
Sys_end $sys_datatype generated always as row end,
|
||||
Sys_end2 $sys_datatype generated always as row end,
|
||||
period for system_time (Sys_start, Sys_end)
|
||||
) with system versioning;
|
||||
|
||||
--error ER_VERS_WRONG_PARAMS
|
||||
create or replace table t1 (
|
||||
XNo int unsigned,
|
||||
Sys_start timestamp(6) generated always as row start,
|
||||
Sys_end2 timestamp(6) generated always as row end,
|
||||
x6 int unsigned,
|
||||
period for system_time (Sys_start, Sys_end)
|
||||
) with system versioning;
|
||||
|
||||
--replace_result "bigint unsigned" SYS_TRX_TYPE timestamp(6) SYS_TRX_TYPE
|
||||
--error ER_VERS_WRONG_PARAMS
|
||||
create or replace 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_VERS_WRONG_PARAMS
|
||||
create or replace table t1 (
|
||||
XNo int unsigned,
|
||||
period for system_time (Sys_start, Sys_end)
|
||||
) with system versioning;
|
||||
|
||||
--error ER_VERS_WRONG_PARAMS
|
||||
create or replace 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,
|
||||
eval create or replace table t1 (
|
||||
x7 int unsigned,
|
||||
Sys_start $sys_datatype generated always as row start,
|
||||
Sys_end $sys_datatype generated always as row end,
|
||||
Sys_end2 $sys_datatype generated always as row end,
|
||||
period for system_time (Sys_start, Sys_end)
|
||||
);
|
||||
|
||||
--replace_result "bigint unsigned" SYS_TRX_TYPE timestamp(6) SYS_TRX_TYPE
|
||||
--error ER_VERS_WRONG_PARAMS
|
||||
create or replace table t1 (
|
||||
XNo int unsigned,
|
||||
Sys_start timestamp(6) generated always as row start,
|
||||
Sys_end timestamp(6) generated always as row end,
|
||||
eval create or replace table t1 (
|
||||
x8 int unsigned,
|
||||
Sys_start $sys_datatype generated always as row start,
|
||||
Sys_end $sys_datatype generated always as row end,
|
||||
period for system_time (sys_insert, sys_remove)
|
||||
) with system versioning;
|
||||
|
||||
--replace_result "bigint unsigned" SYS_TRX_TYPE timestamp(6) SYS_TRX_TYPE
|
||||
--error ER_VERS_WRONG_PARAMS
|
||||
create or replace table t1 (
|
||||
XNo int unsigned,
|
||||
Sys_start timestamp(6) generated always as row start,
|
||||
Sys_end timestamp(6) generated always as row end,
|
||||
eval create or replace table t1 (
|
||||
x9 int unsigned,
|
||||
Sys_start $sys_datatype generated always as row start,
|
||||
Sys_end $sys_datatype generated always as row end,
|
||||
period for system_time (Sys_start, Sys_end)
|
||||
);
|
||||
|
||||
--replace_result "bigint unsigned" SYS_TRX_TYPE timestamp(6) SYS_TRX_TYPE
|
||||
--error ER_VERS_WRONG_PARAMS
|
||||
create or replace table t1 (
|
||||
XNo int unsigned,
|
||||
Sys_start timestamp(6) generated always as row start,
|
||||
Sys_end timestamp(6) generated always as row end,
|
||||
eval create or replace table t1 (
|
||||
x10 int unsigned,
|
||||
Sys_start $sys_datatype generated always as row start,
|
||||
Sys_end $sys_datatype generated always as row end,
|
||||
period for system_time (Sys_start, Sys_start)
|
||||
);
|
||||
|
||||
--error ER_VERS_FIELD_WRONG_TYPE
|
||||
--error ER_VERS_FIELD_WRONG_TYPE, ER_VERS_FIELD_WRONG_TYPE
|
||||
create or replace table t1 (
|
||||
XNo int unsigned,
|
||||
Sys_start int generated always as row start,
|
||||
x11 int unsigned,
|
||||
Sys_start bigint unsigned 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_VERS_FIELD_WRONG_TYPE
|
||||
--error ER_VERS_FIELD_WRONG_TYPE, ER_VERS_FIELD_WRONG_TYPE
|
||||
create or replace table t1 (
|
||||
XNo int unsigned,
|
||||
x12 int unsigned,
|
||||
Sys_start timestamp(6) generated always as row start,
|
||||
Sys_end int generated always as row end,
|
||||
Sys_end bigint unsigned generated always as row end,
|
||||
period for system_time (Sys_start, Sys_end)
|
||||
) with system versioning;
|
||||
|
||||
--error ER_VERS_FIELD_WRONG_TYPE
|
||||
create or replace table t1 (
|
||||
XNo int unsigned,
|
||||
Sys_start timestamp(6) generated always as row start,
|
||||
Sys_end bigint generated always as row end,
|
||||
period for system_time (Sys_start, Sys_end)
|
||||
) with system versioning engine innodb;
|
||||
|
||||
--error ER_VERS_FIELD_WRONG_TYPE
|
||||
create or replace table t1 (
|
||||
XNo int unsigned,
|
||||
x13 int unsigned,
|
||||
Sys_start bigint generated always as row start,
|
||||
Sys_end bigint generated always as row end,
|
||||
Sys_end bigint unsigned generated always as row end,
|
||||
period for system_time (Sys_start, Sys_end)
|
||||
) with system versioning engine innodb;
|
||||
|
||||
--error ER_VERS_FIELD_WRONG_TYPE
|
||||
create or replace table t1 (
|
||||
XNo int unsigned,
|
||||
x14 int unsigned,
|
||||
Sys_start bigint unsigned generated always as row start,
|
||||
Sys_end bigint generated always as row end,
|
||||
period for system_time (Sys_start, Sys_end)
|
||||
) with system versioning engine innodb;
|
||||
|
||||
# columns with/without system versioning
|
||||
|
||||
create or replace table t1 (
|
||||
A int with system versioning,
|
||||
A1 int with system versioning,
|
||||
B int
|
||||
);
|
||||
--replace_result InnoDB INNODB_OR_MYISAM MyISAM INNODB_OR_MYISAM "bigint(20) unsigned" SYS_TRX_TYPE timestamp(6) SYS_TRX_TYPE
|
||||
show create table t1;
|
||||
|
||||
create or replace table t1 (
|
||||
A int with system versioning,
|
||||
A2 int with system versioning,
|
||||
B int
|
||||
) with system versioning;
|
||||
--replace_result InnoDB INNODB_OR_MYISAM MyISAM INNODB_OR_MYISAM "bigint(20) unsigned" SYS_TRX_TYPE timestamp(6) SYS_TRX_TYPE
|
||||
show create table t1;
|
||||
|
||||
--error ER_VERS_WRONG_PARAMS
|
||||
create or replace table t1 (
|
||||
A int,
|
||||
A3 int,
|
||||
B int without system versioning
|
||||
);
|
||||
|
||||
create or replace table t1 (
|
||||
A int,
|
||||
A4 int,
|
||||
B int without system versioning
|
||||
) with system versioning;
|
||||
--replace_result InnoDB INNODB_OR_MYISAM MyISAM INNODB_OR_MYISAM "bigint(20) unsigned" SYS_TRX_TYPE timestamp(6) SYS_TRX_TYPE
|
||||
show create table t1;
|
||||
|
||||
create or replace table t1 (
|
||||
A int with system versioning,
|
||||
A5 int with system versioning,
|
||||
B int without system versioning
|
||||
);
|
||||
--replace_result InnoDB INNODB_OR_MYISAM MyISAM INNODB_OR_MYISAM "bigint(20) unsigned" SYS_TRX_TYPE timestamp(6) SYS_TRX_TYPE
|
||||
show create table t1;
|
||||
|
||||
create or replace table t1 (
|
||||
A int with system versioning,
|
||||
A6 int with system versioning,
|
||||
B int without system versioning
|
||||
) with system versioning;
|
||||
--replace_result InnoDB INNODB_OR_MYISAM MyISAM INNODB_OR_MYISAM "bigint(20) unsigned" SYS_TRX_TYPE timestamp(6) SYS_TRX_TYPE
|
||||
show create table t1;
|
||||
|
||||
--error ER_VERS_WRONG_PARAMS
|
||||
create or replace table t1 (
|
||||
A int without system versioning
|
||||
A7 int without system versioning
|
||||
);
|
||||
|
||||
--error ER_VERS_WRONG_PARAMS
|
||||
create or replace table t1 (
|
||||
A int without system versioning
|
||||
A8 int without system versioning
|
||||
) with system versioning;
|
||||
|
||||
--error ER_VERS_WRONG_PARAMS
|
||||
create or replace table t1 (
|
||||
A int without system versioning with system versioning
|
||||
A9 int without system versioning with system versioning
|
||||
);
|
||||
|
||||
--error ER_VERS_WRONG_PARAMS
|
||||
create or replace table t1 (
|
||||
A int with system versioning without system versioning
|
||||
A10 int with system versioning without system versioning
|
||||
);
|
||||
|
||||
# table with/without system versioning
|
||||
|
||||
--error ER_VERS_WRONG_PARAMS
|
||||
create table t(
|
||||
a int
|
||||
a11 int
|
||||
) without system versioning;
|
||||
|
||||
--error ER_VERS_WRONG_PARAMS
|
||||
create or replace table t1 (
|
||||
A int
|
||||
A12 int
|
||||
) without system versioning with system versioning;
|
||||
|
||||
--error ER_VERS_WRONG_PARAMS
|
||||
create or replace table t1 (
|
||||
A int
|
||||
A13 int
|
||||
) with system versioning without system versioning;
|
||||
|
||||
--error ER_VERS_WRONG_PARAMS
|
||||
create or replace table t1 (
|
||||
A int
|
||||
A14 int
|
||||
) with system versioning with system versioning;
|
||||
|
||||
--error ER_VERS_WRONG_PARAMS
|
||||
create or replace table t1 (
|
||||
A int
|
||||
A15 int
|
||||
) without system versioning without system versioning;
|
||||
|
||||
create or replace table t1 (a int) with system versioning;
|
||||
create temporary table tmp with system versioning select * from t1;
|
||||
|
||||
# CREATE TABLE ... LIKE
|
||||
create or replace table t1 (a int) with system versioning;
|
||||
create table tt1 like t1;
|
||||
--replace_result InnoDB INNODB_OR_MYISAM MyISAM INNODB_OR_MYISAM "bigint(20) unsigned" SYS_TRX_TYPE timestamp(6) SYS_TRX_TYPE
|
||||
show create table tt1;
|
||||
drop table tt1;
|
||||
|
||||
# CREATE TABLE ... SELECT
|
||||
create or replace table t1 (x int) with system versioning;
|
||||
create or replace table t2 (y int);
|
||||
create or replace table t3 select * from t1 for system_time all, t2;
|
||||
--replace_result InnoDB INNODB_OR_MYISAM MyISAM INNODB_OR_MYISAM "bigint(20) unsigned" SYS_TRX_TYPE timestamp(6) SYS_TRX_TYPE
|
||||
show create table t3;
|
||||
|
||||
--replace_result "bigint unsigned" SYS_TRX_TYPE timestamp(6) SYS_TRX_TYPE
|
||||
eval create or replace table t2 (
|
||||
y int,
|
||||
st $sys_datatype generated always as row start,
|
||||
en $sys_datatype generated always as row end,
|
||||
period for system_time (st, en)
|
||||
) with system versioning;
|
||||
create or replace table t3 select * from t2;
|
||||
--replace_result InnoDB INNODB_OR_MYISAM MyISAM INNODB_OR_MYISAM "bigint(20) unsigned" SYS_TRX_TYPE timestamp(6) SYS_TRX_TYPE
|
||||
show create table t3;
|
||||
|
||||
--error ER_VERS_WRONG_PARAMS
|
||||
create or replace table t3 select x, y, t1.sys_trx_start, t2.en from t1, t2;
|
||||
|
||||
insert into t2 values (1), (2);
|
||||
delete from t2 where y = 2;
|
||||
|
||||
create or replace table t3 select * from t2 for system_time all;
|
||||
select st, en from t2 where y = 1 into @st, @en;
|
||||
select y from t2 for system_time all where st = @st and en = @en;
|
||||
select st, en from t2 for system_time all where y = 2 into @st, @en;
|
||||
select y from t2 for system_time all where st = @st and en = @en;
|
||||
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
drop table t3;
|
||||
|
||||
-- source suite/versioning/common_finish.inc
|
||||
|
Reference in New Issue
Block a user