1
0
mirror of https://github.com/MariaDB/server.git synced 2025-12-09 08:01:34 +03:00
Files
mariadb/mysql-test/suite/versioning/r/sysvars.result
Aleksey Midenkov 9e9af76eaf SQL: vers_current_time refactoring [closes #117]
* session sysvars;
* moved value parsing to set variable phase;
* renamed 'temporal_current_timestamp' to 'vers_current_time'.
2017-05-05 20:36:34 +03:00

151 lines
4.5 KiB
Plaintext

create table t (a int) with system versioning;
insert into t values (1);
update t set a= 2;
show global variables like 'vers_current_time';
Variable_name Value
vers_current_time NOW
show variables like 'vers_current_time';
Variable_name Value
vers_current_time NOW
select * from t;
a
2
set vers_current_time = '2031-1-1 0:0:0';
show variables like 'vers_current_time';
Variable_name Value
vers_current_time 2031-01-01 00:00:00.000000
select * from t;
a
2
set vers_current_time = '2011-1-1 0:0:0';
show variables like 'vers_current_time';
Variable_name Value
vers_current_time 2011-01-01 00:00:00.000000
select * from t;
a
set vers_current_time = 'all';
show variables like 'vers_current_time';
Variable_name Value
vers_current_time ALL
select * from t;
a
2
1
create view vt as select * from t;
select * from t;
a
2
1
drop view vt;
select * from (select * from t) as tt;
a
2
1
set global vers_current_time= 'alley';
ERROR 42000: Variable 'vers_current_time' can't be set to the value of 'alley'
set global vers_current_time= null;
ERROR 42000: Variable 'vers_current_time' can't be set to the value of 'NULL'
set global vers_current_time= 1;
ERROR 42000: Incorrect argument type to variable 'vers_current_time'
set global vers_current_time= 1.1;
ERROR 42000: Incorrect argument type to variable 'vers_current_time'
set vers_current_time= 'alley';
ERROR 42000: Variable 'vers_current_time' can't be set to the value of 'alley'
set vers_current_time= null;
ERROR 42000: Variable 'vers_current_time' can't be set to the value of 'NULL'
set vers_current_time= 1;
ERROR 42000: Incorrect argument type to variable 'vers_current_time'
set vers_current_time= 1.1;
ERROR 42000: Incorrect argument type to variable 'vers_current_time'
set global vers_current_time= '1911-11-11 11:11:11.1111119';
show global variables like 'vers_current_time';
Variable_name Value
vers_current_time 1911-11-11 11:11:11.111111
set global vers_current_time= '1900-01-01 00:00:00';
show global variables like 'vers_current_time';
Variable_name Value
vers_current_time 1900-01-01 00:00:00.000000
set global vers_current_time= timestamp'1911-11-11 11:11:11.1111119';
Warnings:
Note 1292 Truncated incorrect datetime value: '1911-11-11 11:11:11.1111119'
show global variables like 'vers_current_time';
Variable_name Value
vers_current_time 1911-11-11 11:11:11.111111
set @ts= timestamp'1900-01-01 00:00:00';
set global vers_current_time= @ts;
show global variables like 'vers_current_time';
Variable_name Value
vers_current_time 1900-01-01 00:00:00.000000
set vers_current_time= '1911-11-11 11:11:11.1111119';
show variables like 'vers_current_time';
Variable_name Value
vers_current_time 1911-11-11 11:11:11.111111
set vers_current_time= '1900-01-01 00:00:00';
show variables like 'vers_current_time';
Variable_name Value
vers_current_time 1900-01-01 00:00:00.000000
set vers_current_time= timestamp'1911-11-11 11:11:11.1111119';
Warnings:
Note 1292 Truncated incorrect datetime value: '1911-11-11 11:11:11.1111119'
show variables like 'vers_current_time';
Variable_name Value
vers_current_time 1911-11-11 11:11:11.111111
set @ts= timestamp'1900-01-01 00:00:00';
set vers_current_time= @ts;
show variables like 'vers_current_time';
Variable_name Value
vers_current_time 1900-01-01 00:00:00.000000
set global vers_current_time= 'now';
set vers_current_time= 'now';
show variables where variable_name = "vers_hide";
Variable_name Value
vers_hide IMPLICIT
select * from t for system_time all;
a
2
1
set vers_hide= AUTO;
select * from t;
a
2
select * from t for system_time as of timestamp current_timestamp(6);
a
2
select * from t for system_time all;
a sys_trx_start sys_trx_end
2 TIMESTAMP TIMESTAMP
1 TIMESTAMP TIMESTAMP
select * from t for system_time timestamp from '0-0-0' to current_timestamp(6);
a sys_trx_start sys_trx_end
2 TIMESTAMP TIMESTAMP
1 TIMESTAMP TIMESTAMP
select * from t for system_time timestamp between '0-0-0' and current_timestamp(6);
a sys_trx_start sys_trx_end
2 TIMESTAMP TIMESTAMP
1 TIMESTAMP TIMESTAMP
set vers_hide= NEVER;
select * from t;
a sys_trx_start sys_trx_end
2 TIMESTAMP TIMESTAMP
set vers_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;
Table Create Table
t CREATE TABLE `t` (
`x` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
insert into t values (1);
delete from t;
select * from t;
x
select * from t for system_time all;
x
1
drop table t;
set vers_hide= IMPLICIT;