blob: 4516833d58dbf47cbc1f72bfdbda30750df7e692 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
create table t (a int) with system versioning;
insert into t values (1);
update t set a= 2;
show global variables like 'versioning_current_timestamp';
show variables like 'versioning_current_timestamp';
select * from t;
set versioning_current_timestamp = '2031-1-1 0:0:0';
show variables like 'versioning_current_timestamp';
select * from t;
set versioning_current_timestamp = '2011-1-1 0:0:0';
show variables like 'versioning_current_timestamp';
select * from t;
set versioning_current_timestamp = 'all';
show variables like 'versioning_current_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_current_timestamp= 'alley';
--error ER_WRONG_VALUE_FOR_VAR
set global versioning_current_timestamp= null;
--error ER_WRONG_TYPE_FOR_VAR
set global versioning_current_timestamp= 1;
--error ER_WRONG_TYPE_FOR_VAR
set global versioning_current_timestamp= 1.1;
# session
--error ER_WRONG_VALUE_FOR_VAR
set versioning_current_timestamp= 'alley';
--error ER_WRONG_VALUE_FOR_VAR
set versioning_current_timestamp= null;
--error ER_WRONG_TYPE_FOR_VAR
set versioning_current_timestamp= 1;
--error ER_WRONG_TYPE_FOR_VAR
set versioning_current_timestamp= 1.1;
# global
set global versioning_current_timestamp= '1911-11-11 11:11:11.1111119';
show global variables like 'versioning_current_timestamp';
set global versioning_current_timestamp= '1900-01-01 00:00:00';
show global variables like 'versioning_current_timestamp';
set global versioning_current_timestamp= timestamp'1911-11-11 11:11:11.1111119';
show global variables like 'versioning_current_timestamp';
set @ts= timestamp'1900-01-01 00:00:00';
set global versioning_current_timestamp= @ts;
show global variables like 'versioning_current_timestamp';
# session
set versioning_current_timestamp= '1911-11-11 11:11:11.1111119';
show variables like 'versioning_current_timestamp';
set versioning_current_timestamp= '1900-01-01 00:00:00';
show variables like 'versioning_current_timestamp';
set versioning_current_timestamp= timestamp'1911-11-11 11:11:11.1111119';
show variables like 'versioning_current_timestamp';
set @ts= timestamp'1900-01-01 00:00:00';
set versioning_current_timestamp= @ts;
show variables like 'versioning_current_timestamp';
set global versioning_current_timestamp= 'now';
set versioning_current_timestamp= 'now';
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 timestamp 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 timestamp 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;
|