1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-20 05:03:09 +03:00
Files
mariadb/mysql-test/suite/versioning/t/sysvars.test
2017-11-13 19:11:02 +03:00

112 lines
3.3 KiB
Plaintext

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';
select * from t;
set versioning_asof_timestamp= '2031-1-1 0:0:0';
show variables like 'versioning_asof_timestamp';
select * from t;
set versioning_asof_timestamp= '2011-1-1 0:0:0';
show variables like 'versioning_asof_timestamp';
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';
--error ER_WRONG_VALUE_FOR_VAR
set global versioning_asof_timestamp= null;
--error ER_WRONG_TYPE_FOR_VAR
set global versioning_asof_timestamp= 1;
--error ER_WRONG_TYPE_FOR_VAR
set global versioning_asof_timestamp= 1.1;
# session
--error ER_WRONG_VALUE_FOR_VAR
set versioning_asof_timestamp= 'alley';
--error ER_WRONG_VALUE_FOR_VAR
set versioning_asof_timestamp= null;
--error ER_WRONG_TYPE_FOR_VAR
set versioning_asof_timestamp= 1;
--error ER_WRONG_TYPE_FOR_VAR
set versioning_asof_timestamp= 1.1;
# global
set global versioning_asof_timestamp= '1911-11-11 11:11:11.1111119';
show global variables like 'versioning_asof_timestamp';
set global versioning_asof_timestamp= '1900-01-01 00:00:00';
show global variables like 'versioning_asof_timestamp';
set global versioning_asof_timestamp= timestamp'1911-11-11 11:11:11.1111119';
show global variables like 'versioning_asof_timestamp';
set @ts= timestamp'1900-01-01 00:00:00';
set global versioning_asof_timestamp= @ts;
show global variables like 'versioning_asof_timestamp';
# session
set versioning_asof_timestamp= '1911-11-11 11:11:11.1111119';
show variables like 'versioning_asof_timestamp';
set versioning_asof_timestamp= '1900-01-01 00:00:00';
show variables like 'versioning_asof_timestamp';
set versioning_asof_timestamp= timestamp'1911-11-11 11:11:11.1111119';
show variables like 'versioning_asof_timestamp';
set @ts= timestamp'1900-01-01 00:00:00';
set versioning_asof_timestamp= @ts;
show variables like 'versioning_asof_timestamp';
set global versioning_asof_timestamp= CURRENT;
set versioning_asof_timestamp= CURRENT;
show variables where variable_name = "versioning_hide";
select * from t for system_time all;
set 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/
select * from t for system_time all;
--replace_regex /\d{4}-\d\d-\d\d \d\d:\d\d:\d\d\.\d{6}/TIMESTAMP/
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;
--replace_regex /\d{4}-\d\d-\d\d \d\d:\d\d:\d\d\.\d{6}/TIMESTAMP/
select * from t;
set versioning_hide= FULL;
create or replace table t (
x int,
st timestamp(6) generated always as row start,
en timestamp(6) generated always as row end,
period for system_time (st, en))
with system versioning;
show create table t;
insert into t values (2);
delete from t;
select * from t;
select * from t for system_time all;
drop table t;
set versioning_hide= IMPLICIT;