2017-03-24 14:00:42 +01:00
|
|
|
create table t (a int) with system versioning;
|
|
|
|
insert into t values (1);
|
|
|
|
update t set a= 2;
|
2017-10-22 19:23:16 +02:00
|
|
|
show global variables like 'versioning_asof_timestamp';
|
2017-03-30 11:57:31 +02:00
|
|
|
Variable_name Value
|
2017-10-22 19:23:16 +02:00
|
|
|
versioning_asof_timestamp CURRENT
|
|
|
|
show variables like 'versioning_asof_timestamp';
|
2017-03-30 11:57:31 +02:00
|
|
|
Variable_name Value
|
2017-10-22 19:23:16 +02:00
|
|
|
versioning_asof_timestamp CURRENT
|
2017-03-24 14:00:42 +01:00
|
|
|
select * from t;
|
|
|
|
a
|
|
|
|
2
|
2017-10-22 19:23:16 +02:00
|
|
|
set versioning_asof_timestamp= '2031-1-1 0:0:0';
|
|
|
|
show variables like 'versioning_asof_timestamp';
|
2017-03-24 14:00:42 +01:00
|
|
|
Variable_name Value
|
2017-10-22 19:23:16 +02:00
|
|
|
versioning_asof_timestamp 2031-01-01 00:00:00.000000
|
2017-03-24 14:00:42 +01:00
|
|
|
select * from t;
|
|
|
|
a
|
|
|
|
2
|
2017-10-22 19:23:16 +02:00
|
|
|
set versioning_asof_timestamp= '2011-1-1 0:0:0';
|
|
|
|
show variables like 'versioning_asof_timestamp';
|
2017-03-30 11:57:31 +02:00
|
|
|
Variable_name Value
|
2017-10-22 19:23:16 +02:00
|
|
|
versioning_asof_timestamp 2011-01-01 00:00:00.000000
|
2017-03-24 14:00:42 +01:00
|
|
|
select * from t;
|
|
|
|
a
|
2017-10-22 19:23:16 +02:00
|
|
|
set versioning_asof_timestamp= ALL;
|
|
|
|
show variables like 'versioning_asof_timestamp';
|
2017-03-30 11:57:31 +02:00
|
|
|
Variable_name Value
|
2017-10-22 19:23:16 +02:00
|
|
|
versioning_asof_timestamp ALL
|
2017-03-24 14:00:42 +01:00
|
|
|
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
|
2017-10-22 19:23:16 +02:00
|
|
|
set global versioning_asof_timestamp= 'alley';
|
|
|
|
ERROR 42000: Variable 'versioning_asof_timestamp' can't be set to the value of 'alley'
|
|
|
|
set global versioning_asof_timestamp= null;
|
|
|
|
ERROR 42000: Variable 'versioning_asof_timestamp' can't be set to the value of 'NULL'
|
|
|
|
set global versioning_asof_timestamp= 1;
|
|
|
|
ERROR 42000: Incorrect argument type to variable 'versioning_asof_timestamp'
|
|
|
|
set global versioning_asof_timestamp= 1.1;
|
|
|
|
ERROR 42000: Incorrect argument type to variable 'versioning_asof_timestamp'
|
|
|
|
set versioning_asof_timestamp= 'alley';
|
|
|
|
ERROR 42000: Variable 'versioning_asof_timestamp' can't be set to the value of 'alley'
|
|
|
|
set versioning_asof_timestamp= null;
|
|
|
|
ERROR 42000: Variable 'versioning_asof_timestamp' can't be set to the value of 'NULL'
|
|
|
|
set versioning_asof_timestamp= 1;
|
|
|
|
ERROR 42000: Incorrect argument type to variable 'versioning_asof_timestamp'
|
|
|
|
set versioning_asof_timestamp= 1.1;
|
|
|
|
ERROR 42000: Incorrect argument type to variable 'versioning_asof_timestamp'
|
|
|
|
set global versioning_asof_timestamp= '1911-11-11 11:11:11.1111119';
|
|
|
|
Warnings:
|
|
|
|
Note 1292 Truncated incorrect datetime value: '1911-11-11 11:11:11.1111119'
|
|
|
|
Note 1292 Truncated incorrect datetime value: '1911-11-11 11:11:11.1111119'
|
|
|
|
show global variables like 'versioning_asof_timestamp';
|
2017-03-30 11:57:31 +02:00
|
|
|
Variable_name Value
|
2017-10-22 19:23:16 +02:00
|
|
|
versioning_asof_timestamp 1911-11-11 11:11:11.111111
|
|
|
|
set global versioning_asof_timestamp= '1900-01-01 00:00:00';
|
|
|
|
show global variables like 'versioning_asof_timestamp';
|
2017-03-30 11:57:31 +02:00
|
|
|
Variable_name Value
|
2017-10-22 19:23:16 +02:00
|
|
|
versioning_asof_timestamp 1900-01-01 00:00:00.000000
|
|
|
|
set global versioning_asof_timestamp= timestamp'1911-11-11 11:11:11.1111119';
|
2017-03-30 11:57:31 +02:00
|
|
|
Warnings:
|
|
|
|
Note 1292 Truncated incorrect datetime value: '1911-11-11 11:11:11.1111119'
|
2017-10-22 19:23:16 +02:00
|
|
|
show global variables like 'versioning_asof_timestamp';
|
2017-03-30 11:57:31 +02:00
|
|
|
Variable_name Value
|
2017-10-22 19:23:16 +02:00
|
|
|
versioning_asof_timestamp 1911-11-11 11:11:11.111111
|
2017-03-30 11:57:31 +02:00
|
|
|
set @ts= timestamp'1900-01-01 00:00:00';
|
2017-10-22 19:23:16 +02:00
|
|
|
set global versioning_asof_timestamp= @ts;
|
|
|
|
show global variables like 'versioning_asof_timestamp';
|
2017-03-30 11:57:31 +02:00
|
|
|
Variable_name Value
|
2017-10-22 19:23:16 +02:00
|
|
|
versioning_asof_timestamp 1900-01-01 00:00:00.000000
|
|
|
|
set versioning_asof_timestamp= '1911-11-11 11:11:11.1111119';
|
|
|
|
Warnings:
|
|
|
|
Note 1292 Truncated incorrect datetime value: '1911-11-11 11:11:11.1111119'
|
|
|
|
Note 1292 Truncated incorrect datetime value: '1911-11-11 11:11:11.1111119'
|
|
|
|
show variables like 'versioning_asof_timestamp';
|
2017-03-30 11:57:31 +02:00
|
|
|
Variable_name Value
|
2017-10-22 19:23:16 +02:00
|
|
|
versioning_asof_timestamp 1911-11-11 11:11:11.111111
|
|
|
|
set versioning_asof_timestamp= '1900-01-01 00:00:00';
|
|
|
|
show variables like 'versioning_asof_timestamp';
|
2017-03-30 11:57:31 +02:00
|
|
|
Variable_name Value
|
2017-10-22 19:23:16 +02:00
|
|
|
versioning_asof_timestamp 1900-01-01 00:00:00.000000
|
|
|
|
set versioning_asof_timestamp= timestamp'1911-11-11 11:11:11.1111119';
|
2017-03-30 11:57:31 +02:00
|
|
|
Warnings:
|
|
|
|
Note 1292 Truncated incorrect datetime value: '1911-11-11 11:11:11.1111119'
|
2017-10-22 19:23:16 +02:00
|
|
|
show variables like 'versioning_asof_timestamp';
|
2017-03-30 11:57:31 +02:00
|
|
|
Variable_name Value
|
2017-10-22 19:23:16 +02:00
|
|
|
versioning_asof_timestamp 1911-11-11 11:11:11.111111
|
2017-03-30 11:57:31 +02:00
|
|
|
set @ts= timestamp'1900-01-01 00:00:00';
|
2017-10-22 19:23:16 +02:00
|
|
|
set versioning_asof_timestamp= @ts;
|
|
|
|
show variables like 'versioning_asof_timestamp';
|
2017-03-30 11:57:31 +02:00
|
|
|
Variable_name Value
|
2017-10-22 19:23:16 +02:00
|
|
|
versioning_asof_timestamp 1900-01-01 00:00:00.000000
|
|
|
|
set global versioning_asof_timestamp= CURRENT;
|
|
|
|
set versioning_asof_timestamp= CURRENT;
|
2017-05-03 05:15:20 +02:00
|
|
|
show variables where variable_name = "versioning_hide";
|
2017-03-24 14:00:42 +01:00
|
|
|
Variable_name Value
|
2017-05-03 05:15:20 +02:00
|
|
|
versioning_hide IMPLICIT
|
2017-03-24 14:00:42 +01:00
|
|
|
select * from t for system_time all;
|
|
|
|
a
|
|
|
|
2
|
|
|
|
1
|
2017-05-03 05:15:20 +02:00
|
|
|
set versioning_hide= AUTO;
|
2017-03-24 14:00:42 +01:00
|
|
|
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
|
2017-08-08 16:12:16 +02:00
|
|
|
select * from t for system_time from '0-0-0' to current_timestamp(6);
|
2017-03-24 14:00:42 +01:00
|
|
|
a sys_trx_start sys_trx_end
|
|
|
|
2 TIMESTAMP TIMESTAMP
|
|
|
|
1 TIMESTAMP TIMESTAMP
|
2017-08-08 16:12:16 +02:00
|
|
|
select * from t for system_time between '0-0-0' and current_timestamp(6);
|
2017-03-24 14:00:42 +01:00
|
|
|
a sys_trx_start sys_trx_end
|
|
|
|
2 TIMESTAMP TIMESTAMP
|
|
|
|
1 TIMESTAMP TIMESTAMP
|
2017-05-03 05:15:20 +02:00
|
|
|
set versioning_hide= NEVER;
|
2017-03-24 14:00:42 +01:00
|
|
|
select * from t;
|
|
|
|
a sys_trx_start sys_trx_end
|
|
|
|
2 TIMESTAMP TIMESTAMP
|
2017-05-03 05:15:20 +02:00
|
|
|
set versioning_hide= FULL;
|
2017-03-24 14:00:42 +01:00
|
|
|
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
|
2017-07-03 16:38:59 +02:00
|
|
|
insert into t values (2);
|
2017-03-24 14:00:42 +01:00
|
|
|
delete from t;
|
|
|
|
select * from t;
|
|
|
|
x
|
|
|
|
select * from t for system_time all;
|
|
|
|
x
|
2017-07-03 16:38:59 +02:00
|
|
|
2
|
2017-03-24 14:00:42 +01:00
|
|
|
drop table t;
|
2017-05-03 05:15:20 +02:00
|
|
|
set versioning_hide= IMPLICIT;
|