mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
System Versioning 1.0 pre6
Merge remote-tracking branch 'mariadb/bb-10.3-temporal-serg' into trunk
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
select @@versioning_alter_history;
|
||||
select @@system_versioning_alter_history;
|
||||
|
||||
create table t(
|
||||
a int
|
||||
@@ -18,7 +18,7 @@ alter table t engine innodb;
|
||||
alter table t drop system versioning;
|
||||
show create table t;
|
||||
|
||||
set versioning_alter_history= keep;
|
||||
set system_versioning_alter_history= keep;
|
||||
|
||||
--error ER_VERS_FIELD_WRONG_TYPE
|
||||
alter table t
|
||||
@@ -205,6 +205,13 @@ alter table t drop system versioning, algorithm=copy;
|
||||
show create table t;
|
||||
call verify_vtq;
|
||||
|
||||
# nullable autoinc test w/o versioning
|
||||
create or replace table t (a int);
|
||||
insert t values (1),(2),(3),(4);
|
||||
alter table t add b int auto_increment null unique;
|
||||
select * from t;
|
||||
drop table t;
|
||||
|
||||
create or replace table t (a int) with system versioning engine=innodb;
|
||||
insert into t values (1), (2), (3);
|
||||
delete from t where a<3;
|
||||
@@ -280,10 +287,10 @@ show create table t;
|
||||
## These experimental options are now disabled
|
||||
|
||||
--error ER_WRONG_VALUE_FOR_VAR
|
||||
set versioning_alter_history= SURVIVE;
|
||||
set system_versioning_alter_history= SURVIVE;
|
||||
|
||||
--error ER_WRONG_VALUE_FOR_VAR
|
||||
set versioning_alter_history= DROP;
|
||||
set system_versioning_alter_history= DROP;
|
||||
|
||||
if (0)
|
||||
{
|
||||
|
@@ -1,2 +1,2 @@
|
||||
--plugin-load=versioning
|
||||
--versioning-hide=implicit
|
||||
--system-versioning-hide=implicit
|
||||
|
@@ -109,8 +109,8 @@ insert emp values (4, 'john', 1);
|
||||
insert addr values (4, 'Paris');
|
||||
with ancestors as (select * from emp natural join addr) select * from ancestors;
|
||||
with ancestors as (select * from emp natural join addr) select * from ancestors for system_time all;
|
||||
with ancestors as (select * from emp natural join addr where 1 for system_time all) select * from ancestors;
|
||||
select * from emp natural join addr where 1 for system_time all;
|
||||
with ancestors as (select * from (select * from emp natural join addr) for system_time all as t) select * from ancestors;
|
||||
select * from (select * from emp natural join addr) for system_time all as t;
|
||||
|
||||
drop table emp;
|
||||
drop table dept;
|
||||
|
@@ -57,18 +57,17 @@ as
|
||||
select * from ancestors";
|
||||
prepare stmt from @tmp; execute stmt; drop prepare stmt;
|
||||
|
||||
#385
|
||||
with recursive
|
||||
ancestors
|
||||
as
|
||||
(
|
||||
select e.emp_id, e.name, e.mgr
|
||||
from emp as e
|
||||
from emp for system_time as of timestamp @ts as e
|
||||
where name = 'bill'
|
||||
for system_time as of timestamp @ts
|
||||
union
|
||||
select ee.emp_id, ee.name, ee.mgr
|
||||
from emp
|
||||
for system_time as of timestamp @ts as ee,
|
||||
from emp for system_time as of timestamp @ts as ee,
|
||||
ancestors as a
|
||||
where ee.mgr = a.emp_id
|
||||
)
|
||||
@@ -79,9 +78,8 @@ ancestors
|
||||
as
|
||||
(
|
||||
select e.emp_id, e.name, e.mgr
|
||||
from emp as e
|
||||
from emp for system_time as of timestamp @ts as e
|
||||
where name = 'bill'
|
||||
for system_time as of timestamp @ts
|
||||
union
|
||||
select ee.emp_id, ee.name, ee.mgr
|
||||
from emp for system_time as of timestamp @ts as ee,
|
||||
@@ -125,7 +123,7 @@ select * from (select * from vt1, t2) as s0;
|
||||
|
||||
--echo ### SYSTEM_TIME clash
|
||||
--error ER_VERS_SYSTEM_TIME_CLASH
|
||||
select * from (select * from t1 for system_time all) dt0 for system_time all;
|
||||
select * from (select * from t1 for system_time all) for system_time all as dt0;
|
||||
--error ER_VERS_SYSTEM_TIME_CLASH
|
||||
select * from vt1 for system_time all;
|
||||
--error ER_VERS_SYSTEM_TIME_CLASH
|
||||
|
@@ -1 +1 @@
|
||||
--versioning-hide=implicit
|
||||
--system-versioning-hide=implicit
|
||||
|
@@ -9,23 +9,16 @@ select * from t;
|
||||
select a from t for system_time as of timestamp now(6);
|
||||
select a, b, b+0 from t for system_time as of timestamp now(6);
|
||||
select * from t for system_time as of timestamp now(6);
|
||||
select count(*) from t group by b for system_time as of timestamp now(6);
|
||||
select count(*) from t for system_time as of timestamp now(6) group by b;
|
||||
select * from t for system_time as of timestamp now(6) order by b asc;
|
||||
select * from t for system_time as of timestamp now(6) order by b desc;
|
||||
select * from t group by a having a=2 for system_time as of timestamp now(6);
|
||||
select * from t group by b having b=2 for system_time as of timestamp now(6);
|
||||
select a from t where b=2 for system_time as of timestamp now(6);
|
||||
select a from t where b=NULL for system_time as of timestamp now(6);
|
||||
select a from t where b is NULL for system_time as of timestamp now(6);
|
||||
select count(*), b from t group by b having b=NULL for system_time as of timestamp now(6);
|
||||
select a, b from t;
|
||||
|
||||
select count(*) from t for system_time as of timestamp now(6) group by b;
|
||||
select * from t for system_time as of timestamp now(6) group by a having a=2;
|
||||
select * from t for system_time as of timestamp now(6) group by b having b=2;
|
||||
select a from t for system_time as of timestamp now(6) where b=2;
|
||||
select a from t for system_time as of timestamp now(6) where b=NULL;
|
||||
select a from t for system_time as of timestamp now(6) where b is NULL;
|
||||
select count(*), b from t for system_time as of timestamp now(6) group by b having b=NULL;
|
||||
select a, b from t;
|
||||
|
||||
create or replace table t (
|
||||
a int,
|
||||
|
@@ -1,2 +1 @@
|
||||
--partition
|
||||
--versioning-hide=implicit
|
||||
--system-versioning-hide=implicit
|
||||
|
@@ -1,3 +1,4 @@
|
||||
-- source include/have_partition.inc
|
||||
-- source suite/versioning/common.inc
|
||||
|
||||
--echo ### check System Versioning and conventional partitioning
|
||||
@@ -16,8 +17,8 @@ select * from t1 partition (p1);
|
||||
delete from t1;
|
||||
select * from t1;
|
||||
select * from t1 for system_time all;
|
||||
select * from t1 partition (p0) for system_time all;
|
||||
select * from t1 partition (p1) for system_time all;
|
||||
select * from t1 partition (p0);
|
||||
select * from t1 partition (p1);
|
||||
|
||||
--echo ### Engine change versioned/non-versioned prohibited
|
||||
eval create or replace table t1 (i int) engine=$default_engine with system versioning partition by hash(i);
|
||||
@@ -30,56 +31,56 @@ eval alter table t1 engine=$non_default_engine;
|
||||
--error ER_VERS_ENGINE_UNSUPPORTED
|
||||
create or replace table t1 (x int)
|
||||
partition by system_time (
|
||||
partition p0 versioning,
|
||||
partition pn as of current_timestamp);
|
||||
partition p0 history,
|
||||
partition pn current);
|
||||
|
||||
create or replace table t1 (x int);
|
||||
--error ER_VERS_ENGINE_UNSUPPORTED,ER_VERS_ENGINE_UNSUPPORTED
|
||||
alter table t1
|
||||
partition by system_time (
|
||||
partition p0 versioning,
|
||||
partition pn as of current_timestamp);
|
||||
partition p0 history,
|
||||
partition pn current);
|
||||
|
||||
--error ER_VERS_WRONG_PARTS
|
||||
create or replace table t1 (x int)
|
||||
with system versioning
|
||||
partition by system_time (
|
||||
partition p0 as of current_timestamp);
|
||||
partition p0 current);
|
||||
|
||||
--error ER_VERS_WRONG_PARTS
|
||||
create or replace table t1 (x int)
|
||||
with system versioning
|
||||
partition by system_time (
|
||||
partition p0 as of current_timestamp,
|
||||
partition p1 as of current_timestamp);
|
||||
partition p0 current,
|
||||
partition p1 current);
|
||||
|
||||
--error ER_VERS_WRONG_PARTS
|
||||
create or replace table t1 (x int)
|
||||
with system versioning
|
||||
partition by system_time (
|
||||
partition p0 versioning,
|
||||
partition p1 versioning);
|
||||
partition p0 history,
|
||||
partition p1 history);
|
||||
|
||||
--error ER_VERS_WRONG_PARTS
|
||||
create or replace table t1 (x int)
|
||||
with system versioning
|
||||
partition by system_time (
|
||||
partition pn as of current_timestamp,
|
||||
partition p0 versioning);
|
||||
partition pn current,
|
||||
partition p0 history);
|
||||
|
||||
create or replace table t1 (x int)
|
||||
with system versioning
|
||||
partition by system_time (
|
||||
partition p0 versioning,
|
||||
partition pn as of current_timestamp);
|
||||
partition p0 history,
|
||||
partition pn current);
|
||||
|
||||
# alter table
|
||||
--error ER_VERS_WRONG_PARTS
|
||||
alter table t1 add partition (
|
||||
partition p1 as of current_timestamp);
|
||||
partition p1 current);
|
||||
|
||||
alter table t1 add partition (
|
||||
partition p1 versioning);
|
||||
partition p1 history);
|
||||
|
||||
--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;
|
||||
@@ -98,16 +99,16 @@ select x from t1;
|
||||
create or replace table t1 (x int)
|
||||
with system versioning
|
||||
partition by system_time (
|
||||
partition p0 versioning,
|
||||
partition pn as of current_timestamp);
|
||||
partition p0 history,
|
||||
partition pn current);
|
||||
|
||||
set @now= now(6);
|
||||
insert into t1 values (1);
|
||||
set @ts_start= sys_commit_ts('sys_trx_start');
|
||||
set @ts_end= sys_commit_ts('sys_trx_end');
|
||||
set @str= concat('select x, ', @ts_start, ' < @now as A, ', @ts_end, ' > @now as B from t1 partition (p0) for system_time all');
|
||||
set @str= concat('select x, ', @ts_start, ' < @now as A, ', @ts_end, ' > @now as B from t1 partition (p0)');
|
||||
prepare select_p0 from @str;
|
||||
set @str= concat('select x, ', @ts_start, ' > @now as C, ', @ts_end, ' = timestamp\'2038-01-19 03:14:07.999999\' as D from t1 partition (pn) for system_time all');
|
||||
set @str= concat('select x, ', @ts_start, ' > @now as C, ', @ts_end, ' = timestamp\'2038-01-19 03:14:07.999999\' as D from t1 partition (pn)');
|
||||
prepare select_pn from @str;
|
||||
|
||||
execute select_p0;
|
||||
@@ -125,7 +126,7 @@ delete from t1;
|
||||
execute select_p0;
|
||||
execute select_pn;
|
||||
|
||||
set @str= concat('select ', @ts_start, ' from t1 partition (p0) for system_time all into @ts1');
|
||||
set @str= concat('select ', @ts_start, ' from t1 partition (p0) into @ts1');
|
||||
prepare stmt from @str; execute stmt; drop prepare stmt;
|
||||
|
||||
select @ts0 = @ts1;
|
||||
@@ -146,9 +147,9 @@ execute select_pn;
|
||||
drop prepare select_p0;
|
||||
drop prepare select_pn;
|
||||
|
||||
set @str= concat('select ', @ts_start, ' from t1 partition (p0) for system_time all where x = 2 into @ts1');
|
||||
set @str= concat('select ', @ts_start, ' from t1 partition (p0) where x = 2 into @ts1');
|
||||
prepare stmt from @str; execute stmt; drop prepare stmt;
|
||||
set @str= concat('select ', @ts_end, ' from t1 partition (p0) for system_time all where x = 2 into @ts2');
|
||||
set @str= concat('select ', @ts_end, ' from t1 partition (p0) where x = 2 into @ts2');
|
||||
prepare stmt from @str; execute stmt; drop prepare stmt;
|
||||
set @str= concat('select ', @ts_start, ' from t1 partition (pn) into @ts3');
|
||||
prepare stmt from @str; execute stmt; drop prepare stmt;
|
||||
@@ -161,16 +162,16 @@ select @ts2 = @ts3;
|
||||
create or replace table t1 (x int)
|
||||
with system versioning
|
||||
partition by system_time limit 0 (
|
||||
partition p0 versioning,
|
||||
partition p1 versioning,
|
||||
partition pn as of current_timestamp);
|
||||
partition p0 history,
|
||||
partition p1 history,
|
||||
partition pn current);
|
||||
|
||||
create or replace table t1 (x int)
|
||||
with system versioning
|
||||
partition by system_time limit 1 (
|
||||
partition p0 versioning,
|
||||
partition p1 versioning,
|
||||
partition pn as of current_timestamp);
|
||||
partition p0 history,
|
||||
partition p1 history,
|
||||
partition pn current);
|
||||
|
||||
--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;
|
||||
@@ -181,38 +182,38 @@ alter table t1 drop partition non_existent;
|
||||
insert into t1 values (1), (2);
|
||||
select * from t1 partition (pn);
|
||||
delete from t1;
|
||||
select * from t1 partition (p0) for system_time all;
|
||||
select * from t1 partition (p1) for system_time all;
|
||||
select * from t1 partition (p0);
|
||||
select * from t1 partition (p1);
|
||||
|
||||
insert into t1 values (3);
|
||||
delete from t1;
|
||||
select * from t1 partition (p1) for system_time all;
|
||||
select * from t1 partition (p1);
|
||||
|
||||
# rotation by INTERVAL
|
||||
--error ER_PART_WRONG_VALUE
|
||||
create or replace table t1 (x int)
|
||||
with system versioning
|
||||
partition by system_time interval 0 second (
|
||||
partition p0 versioning,
|
||||
partition p1 versioning,
|
||||
partition pn as of current_timestamp);
|
||||
partition p0 history,
|
||||
partition p1 history,
|
||||
partition pn current);
|
||||
|
||||
create or replace table t1 (x int)
|
||||
with system versioning
|
||||
partition by system_time interval 1 second (
|
||||
partition p0 versioning,
|
||||
partition p1 versioning,
|
||||
partition pn as of current_timestamp);
|
||||
partition p0 history,
|
||||
partition p1 history,
|
||||
partition pn current);
|
||||
|
||||
insert into t1 values (1), (2), (3);
|
||||
select * from t1 partition (pn);
|
||||
delete from t1;
|
||||
select * from t1 partition (p0) for system_time all;
|
||||
select * from t1 partition (p0);
|
||||
|
||||
--sleep 2
|
||||
insert into t1 values (4);
|
||||
delete from t1;
|
||||
select * from t1 partition (p1) for system_time all;
|
||||
select * from t1 partition (p1);
|
||||
|
||||
# Subpartitions
|
||||
create or replace table t1 (x int)
|
||||
@@ -220,19 +221,19 @@ with system versioning
|
||||
partition by system_time limit 1
|
||||
subpartition by key (x)
|
||||
subpartitions 2 (
|
||||
partition p0 versioning,
|
||||
partition p1 versioning,
|
||||
partition pn as of current_timestamp);
|
||||
partition p0 history,
|
||||
partition p1 history,
|
||||
partition pn current);
|
||||
|
||||
insert into t1 (x) values (1), (2), (3);
|
||||
select * from t1 partition (pnsp0);
|
||||
select * from t1 partition (pnsp1);
|
||||
|
||||
delete from t1;
|
||||
select * from t1 partition (p0sp0) for system_time all;
|
||||
select * from t1 partition (p0sp1) for system_time all;
|
||||
select * from t1 partition (p1sp0) for system_time all;
|
||||
select * from t1 partition (p1sp1) for system_time all;
|
||||
select * from t1 partition (p0sp0);
|
||||
select * from t1 partition (p0sp1);
|
||||
select * from t1 partition (p1sp0);
|
||||
select * from t1 partition (p1sp1);
|
||||
|
||||
create or replace table t1 (a bigint)
|
||||
with system versioning
|
||||
|
@@ -1 +1 @@
|
||||
--versioning-hide=implicit
|
||||
--system-versioning-hide=implicit
|
||||
|
@@ -84,12 +84,21 @@ select t1.x as RJ1_x1, t1.y as y1, t2.x as x2, t2.y as y2 from t1 right join t2
|
||||
delete from t1;
|
||||
delete from t2;
|
||||
|
||||
select t1.x as IJ2_x1, t1.y as y1, t2.x as x2, t2.y as y2 from t1 inner join t2 on t1.x = t2.x
|
||||
for system_time as of timestamp @t0;
|
||||
select t1.x as LJ2_x1, t1.y as y1, t2.x as x2, t2.y as y2 from t1 left join t2 on t1.x = t2.x
|
||||
for system_time as of timestamp @t0;
|
||||
select t1.x as RJ2_x1, t1.y as y1, t2.x as x2, t2.y as y2 from t1 right join t2 on t1.x = t2.x
|
||||
for system_time as of timestamp @t0;
|
||||
#384
|
||||
explain extended select * from (select t1.x as IJ2_x1, t1.y as y1, t2.x as x2, t2.y as y2 from t1 inner join t2 on t1.x = t2.x)
|
||||
for system_time as of timestamp @t0 as t;
|
||||
explain extended select * from (select t1.x as LJ2_x1, t1.y as y1, t2.x as x2, t2.y as y2 from t1 left join t2 on t1.x = t2.x)
|
||||
for system_time as of timestamp @t0 as t;
|
||||
#383
|
||||
explain extended select * from (select t1.x as RJ2_x1, t1.y as y1, t2.x as x2, t2.y as y2 from t1 right join t2 on t1.x = t2.x)
|
||||
for system_time as of timestamp @t0 as t;
|
||||
|
||||
select * from (select t1.x as IJ2_x1, t1.y as y1, t2.x as x2, t2.y as y2 from t1 inner join t2 on t1.x = t2.x)
|
||||
for system_time as of timestamp @t0 as t;
|
||||
select * from (select t1.x as LJ2_x1, t1.y as y1, t2.x as x2, t2.y as y2 from t1 left join t2 on t1.x = t2.x)
|
||||
for system_time as of timestamp @t0 as t;
|
||||
select * from (select t1.x as RJ2_x1, t1.y as y1, t2.x as x2, t2.y as y2 from t1 right join t2 on t1.x = t2.x)
|
||||
for system_time as of timestamp @t0 as t;
|
||||
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
@@ -179,8 +188,9 @@ delete from t1 where x = 3;
|
||||
insert into t2 values (1);
|
||||
select * from t1, t2 for system_time all;
|
||||
|
||||
--error ER_VERS_UNUSED_CLAUSE
|
||||
select * from t1 for system_time all, t2 for system_time all for system_time all;
|
||||
--error ER_VERS_SYSTEM_TIME_CLASH
|
||||
select * from (select * from t1 for system_time all, t2 for system_time all)
|
||||
for system_time all as t;
|
||||
|
||||
--echo # TRANSACTION/TIMESTAMP specifier in SYSTEM_TIME [MDEV-14645, Issue #396]
|
||||
create or replace table t1 (x int) with system versioning engine myisam;
|
||||
|
@@ -93,12 +93,12 @@ begin
|
||||
delete from t1;
|
||||
delete from t2;
|
||||
|
||||
select t1.x as IJ2_x1, t1.y as y1, t2.x as x2, t2.y as y2 from t1 inner join t2 on t1.x = t2.x
|
||||
for system_time as of timestamp @t0;
|
||||
select t1.x as LJ2_x1, t1.y as y1, t2.x as x2, t2.y as y2 from t1 left join t2 on t1.x = t2.x
|
||||
for system_time as of timestamp @t0;
|
||||
select t1.x as RJ2_x1, t1.y as y1, t2.x as x2, t2.y as y2 from t1 right join t2 on t1.x = t2.x
|
||||
for system_time as of timestamp @t0;
|
||||
select IJ2_x1,y1,x2,y2 from (select t1.x as IJ2_x1, t1.y as y1, t2.x as x2, t2.y as y2 from t1 inner join t2 on t1.x = t2.x)
|
||||
for system_time as of timestamp @t0 as t;
|
||||
select LJ2_x1,y1,x2,y2 from (select t1.x as LJ2_x1, t1.y as y1, t2.x as x2, t2.y as y2 from t1 left join t2 on t1.x = t2.x)
|
||||
for system_time as of timestamp @t0 as t;
|
||||
select RJ2_x1,y1,x2,y2 from (select t1.x as RJ2_x1, t1.y as y1, t2.x as x2, t2.y as y2 from t1 right join t2 on t1.x = t2.x)
|
||||
for system_time as of timestamp @t0 as t;
|
||||
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
@@ -192,8 +192,10 @@ delete from t1 where x = 3;
|
||||
insert into t2 values (1);
|
||||
select * from t1, t2 for system_time all;
|
||||
|
||||
--error ER_VERS_UNUSED_CLAUSE
|
||||
select * from t1 for system_time all, t2 for system_time all for system_time all;
|
||||
--error ER_VERS_SYSTEM_TIME_CLASH
|
||||
select * from (select * from t1 for system_time all, t2 for system_time all) for system_time all as t;
|
||||
--error ER_PARSE_ERROR
|
||||
select * from (t1 for system_time all join t2 for system_time all) for system_time all;
|
||||
|
||||
drop view v1;
|
||||
drop table t1, t2;
|
||||
|
@@ -44,29 +44,30 @@ select * from emp e, dept d
|
||||
where d.dept_id = 10
|
||||
and d.dept_id = e.dept_id;
|
||||
|
||||
select * from emp e, dept d
|
||||
select * from
|
||||
emp for system_time from timestamp @ts_1 to timestamp @ts_2 e,
|
||||
dept for system_time from timestamp @ts_1 to timestamp @ts_2 d
|
||||
where d.dept_id = 10
|
||||
and d.dept_id = e.dept_id
|
||||
for system_time from timestamp @ts_1 to timestamp @ts_2;
|
||||
and d.dept_id = e.dept_id;
|
||||
|
||||
set statement system_versioning_asof=@ts_0 for
|
||||
select * from emp e, dept d
|
||||
where d.dept_id = 10
|
||||
and d.dept_id = e.dept_id
|
||||
for system_time as of timestamp @ts_0;
|
||||
and d.dept_id = e.dept_id;
|
||||
|
||||
set statement system_versioning_asof=@ts_1 for
|
||||
select * from emp e, dept d
|
||||
where d.dept_id = 10
|
||||
and d.dept_id = e.dept_id
|
||||
for system_time as of timestamp @ts_1;
|
||||
and d.dept_id = e.dept_id;
|
||||
|
||||
set statement system_versioning_asof=@ts_2 for
|
||||
select * from emp e, dept d
|
||||
where d.dept_id = 10
|
||||
and d.dept_id = e.dept_id
|
||||
for system_time as of timestamp @ts_2;
|
||||
and d.dept_id = e.dept_id;
|
||||
|
||||
set statement system_versioning_asof=@ts_3 for
|
||||
select * from emp e, dept d
|
||||
where d.dept_id = 10
|
||||
and d.dept_id = e.dept_id
|
||||
for system_time as of timestamp @ts_3;
|
||||
and d.dept_id = e.dept_id;
|
||||
|
||||
drop table emp, dept;
|
||||
|
@@ -1 +1 @@
|
||||
--versioning-hide=implicit
|
||||
--system-versioning-hide=implicit
|
||||
|
@@ -2,83 +2,73 @@ create table t (a int) with system versioning;
|
||||
insert into t values (1);
|
||||
update t set a= 2;
|
||||
|
||||
show global variables like 'versioning_asof_timestamp';
|
||||
show variables like 'versioning_asof_timestamp';
|
||||
show global variables like 'system_versioning_asof';
|
||||
show variables like 'system_versioning_asof';
|
||||
select * from t;
|
||||
|
||||
set versioning_asof_timestamp= '2031-1-1 0:0:0';
|
||||
show variables like 'versioning_asof_timestamp';
|
||||
set system_versioning_asof= '2031-1-1 0:0:0';
|
||||
show variables like 'system_versioning_asof';
|
||||
select * from t;
|
||||
|
||||
set versioning_asof_timestamp= '2011-1-1 0:0:0';
|
||||
show variables like 'versioning_asof_timestamp';
|
||||
set system_versioning_asof= '2011-1-1 0:0:0';
|
||||
show variables like 'system_versioning_asof';
|
||||
select * from t;
|
||||
|
||||
set versioning_asof_timestamp= ALL;
|
||||
show variables like 'versioning_asof_timestamp';
|
||||
select * from t;
|
||||
|
||||
create view vt as select * from t;
|
||||
select * from t;
|
||||
drop view vt;
|
||||
|
||||
select * from (select * from t) as tt;
|
||||
|
||||
# global
|
||||
--error ER_WRONG_VALUE_FOR_VAR
|
||||
set global versioning_asof_timestamp= 'alley';
|
||||
set global system_versioning_asof= 'alley';
|
||||
--error ER_WRONG_VALUE_FOR_VAR
|
||||
set global versioning_asof_timestamp= null;
|
||||
set global system_versioning_asof= null;
|
||||
--error ER_WRONG_TYPE_FOR_VAR
|
||||
set global versioning_asof_timestamp= 1;
|
||||
set global system_versioning_asof= 1;
|
||||
--error ER_WRONG_TYPE_FOR_VAR
|
||||
set global versioning_asof_timestamp= 1.1;
|
||||
set global system_versioning_asof= 1.1;
|
||||
|
||||
# session
|
||||
--error ER_WRONG_VALUE_FOR_VAR
|
||||
set versioning_asof_timestamp= 'alley';
|
||||
set system_versioning_asof= 'alley';
|
||||
--error ER_WRONG_VALUE_FOR_VAR
|
||||
set versioning_asof_timestamp= null;
|
||||
set system_versioning_asof= null;
|
||||
--error ER_WRONG_TYPE_FOR_VAR
|
||||
set versioning_asof_timestamp= 1;
|
||||
set system_versioning_asof= 1;
|
||||
--error ER_WRONG_TYPE_FOR_VAR
|
||||
set versioning_asof_timestamp= 1.1;
|
||||
set system_versioning_asof= 1.1;
|
||||
|
||||
# global
|
||||
set global versioning_asof_timestamp= '1911-11-11 11:11:11.1111119';
|
||||
show global variables like 'versioning_asof_timestamp';
|
||||
set global system_versioning_asof= '1911-11-11 11:11:11.1111119';
|
||||
show global variables like 'system_versioning_asof';
|
||||
|
||||
set global versioning_asof_timestamp= '1900-01-01 00:00:00';
|
||||
show global variables like 'versioning_asof_timestamp';
|
||||
set global system_versioning_asof= '1900-01-01 00:00:00';
|
||||
show global variables like 'system_versioning_asof';
|
||||
|
||||
set global versioning_asof_timestamp= timestamp'1911-11-11 11:11:11.1111119';
|
||||
show global variables like 'versioning_asof_timestamp';
|
||||
set global system_versioning_asof= timestamp'1911-11-11 11:11:11.1111119';
|
||||
show global variables like 'system_versioning_asof';
|
||||
|
||||
set @ts= timestamp'1900-01-01 00:00:00';
|
||||
set global versioning_asof_timestamp= @ts;
|
||||
show global variables like 'versioning_asof_timestamp';
|
||||
set global system_versioning_asof= @ts;
|
||||
show global variables like 'system_versioning_asof';
|
||||
|
||||
# session
|
||||
set versioning_asof_timestamp= '1911-11-11 11:11:11.1111119';
|
||||
show variables like 'versioning_asof_timestamp';
|
||||
set system_versioning_asof= '1911-11-11 11:11:11.1111119';
|
||||
show variables like 'system_versioning_asof';
|
||||
|
||||
set versioning_asof_timestamp= '1900-01-01 00:00:00';
|
||||
show variables like 'versioning_asof_timestamp';
|
||||
set system_versioning_asof= '1900-01-01 00:00:00';
|
||||
show variables like 'system_versioning_asof';
|
||||
|
||||
set versioning_asof_timestamp= timestamp'1911-11-11 11:11:11.1111119';
|
||||
show variables like 'versioning_asof_timestamp';
|
||||
set system_versioning_asof= timestamp'1911-11-11 11:11:11.1111119';
|
||||
show variables like 'system_versioning_asof';
|
||||
|
||||
set @ts= timestamp'1900-01-01 00:00:00';
|
||||
set versioning_asof_timestamp= @ts;
|
||||
show variables like 'versioning_asof_timestamp';
|
||||
set system_versioning_asof= @ts;
|
||||
show variables like 'system_versioning_asof';
|
||||
|
||||
set global versioning_asof_timestamp= CURRENT;
|
||||
set versioning_asof_timestamp= CURRENT;
|
||||
set global system_versioning_asof= DEFAULT;
|
||||
set system_versioning_asof= DEFAULT;
|
||||
|
||||
show variables where variable_name = "versioning_hide";
|
||||
show variables where variable_name = "system_versioning_hide";
|
||||
select * from t for system_time all;
|
||||
|
||||
set versioning_hide= AUTO;
|
||||
set system_versioning_hide= AUTO;
|
||||
select * from t;
|
||||
select * from t for system_time as of timestamp current_timestamp(6);
|
||||
--replace_regex /\d{4}-\d\d-\d\d \d\d:\d\d:\d\d\.\d{6}/TIMESTAMP/
|
||||
@@ -88,11 +78,11 @@ select * from t for system_time from '0-0-0' to current_timestamp(6);
|
||||
--replace_regex /\d{4}-\d\d-\d\d \d\d:\d\d:\d\d\.\d{6}/TIMESTAMP/
|
||||
select * from t for system_time between '0-0-0' and current_timestamp(6);
|
||||
|
||||
set versioning_hide= NEVER;
|
||||
set system_versioning_hide= NEVER;
|
||||
--replace_regex /\d{4}-\d\d-\d\d \d\d:\d\d:\d\d\.\d{6}/TIMESTAMP/
|
||||
select * from t;
|
||||
|
||||
set versioning_hide= FULL;
|
||||
set system_versioning_hide= FULL;
|
||||
create or replace table t (
|
||||
x int,
|
||||
st timestamp(6) generated always as row start,
|
||||
@@ -108,4 +98,4 @@ select * from t;
|
||||
select * from t for system_time all;
|
||||
|
||||
drop table t;
|
||||
set versioning_hide= IMPLICIT;
|
||||
set system_versioning_hide= IMPLICIT;
|
||||
|
@@ -1,2 +1,2 @@
|
||||
--versioning-hide=implicit
|
||||
--system-versioning-hide=implicit
|
||||
--partition
|
||||
|
@@ -34,8 +34,8 @@ create or replace table t (a int)
|
||||
with system versioning
|
||||
engine myisam
|
||||
partition by system_time (
|
||||
partition p0 versioning,
|
||||
partition pn as of current_timestamp);
|
||||
partition p0 history,
|
||||
partition pn current);
|
||||
|
||||
--error ER_NOT_ALLOWED_COMMAND
|
||||
truncate table t to system_time current_timestamp;
|
||||
|
@@ -26,8 +26,8 @@ show grants;
|
||||
truncate mysqltest.t to system_time now();
|
||||
|
||||
connection root;
|
||||
grant delete versioning rows on mysqltest.* to mysqltest_1@localhost;
|
||||
grant delete versioning rows on mysqltest.t to mysqltest_1@localhost;
|
||||
grant delete history on mysqltest.* to mysqltest_1@localhost;
|
||||
grant delete history on mysqltest.t to mysqltest_1@localhost;
|
||||
|
||||
connection user1;
|
||||
show grants;
|
||||
|
@@ -1 +1 @@
|
||||
--versioning-hide=implicit
|
||||
--system-versioning-hide=implicit
|
||||
|
Reference in New Issue
Block a user