Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
eff649eb
Commit
eff649eb
authored
Nov 21, 2016
by
Aleksey Midenkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Parser: syntax extension FOR SYSTEM_TIME ALL
parent
9a7a9ae9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
4 deletions
+40
-4
mysql-test/suite/versioning/r/select.result
mysql-test/suite/versioning/r/select.result
+25
-0
mysql-test/suite/versioning/t/select.test
mysql-test/suite/versioning/t/select.test
+5
-4
sql/sql_yacc.yy
sql/sql_yacc.yy
+10
-0
No files found.
mysql-test/suite/versioning/r/select.result
View file @
eff649eb
...
...
@@ -59,6 +59,7 @@ select x as FROMTO_x, y from t1 for system_time from timestamp '0-0-0 0:0:0' to
select x as BETWAND_x, y from t1 for system_time between timestamp '0-0-0 0:0:0' and timestamp @t1;
select x as FROMTO_ext_x, y from t1 for system_time from timestamp '0-0-0 0:0:0' to timestamp @t1;
select x as BETWAND_ext_x, y from t1 for system_time between timestamp '0-0-0 0:0:0' and timestamp @t1;
select x as ALL_x, y from t1 for system_time all;
if engine = 'innodb' then
select x as ASOF2_x, y from t1 for system_time as of transaction @x0;
select x as FROMTO2_x, y from t1 for system_time from transaction 0 to transaction @x1;
...
...
@@ -169,6 +170,18 @@ BETWAND_ext_x y
8 108
9 109
3 33
ALL_x y
0 100
1 101
2 102
3 103
4 104
5 105
6 106
7 107
8 108
9 109
3 33
call test_01('bigint unsigned', 'innodb', 'vtq_commit_ts(sys_start)');
x y
0 100
...
...
@@ -236,6 +249,18 @@ BETWAND_ext_x y
8 108
9 109
3 33
ALL_x y
0 100
1 101
2 102
3 103
4 104
5 105
6 106
7 107
8 108
9 109
3 33
ASOF2_x y
0 100
1 101
...
...
mysql-test/suite/versioning/t/select.test
View file @
eff649eb
...
...
@@ -48,6 +48,7 @@ begin
select
x
as
BETWAND_x
,
y
from
t1
for
system_time
between
timestamp
'0-0-0 0:0:0'
and
timestamp
@
t1
;
select
x
as
FROMTO_ext_x
,
y
from
t1
for
system_time
from
timestamp
'0-0-0 0:0:0'
to
timestamp
@
t1
;
select
x
as
BETWAND_ext_x
,
y
from
t1
for
system_time
between
timestamp
'0-0-0 0:0:0'
and
timestamp
@
t1
;
select
x
as
ALL_x
,
y
from
t1
for
system_time
all
;
if
engine
=
'innodb'
then
select
x
as
ASOF2_x
,
y
from
t1
for
system_time
as
of
transaction
@
x0
;
...
...
@@ -77,18 +78,18 @@ begin
prepare
stmt
from
@
str
;
execute
stmt
;
drop
prepare
stmt
;
set
@
str
=
concat
(
'create or replace table t2'
,
@
str0
);
prepare
stmt
from
@
str
;
execute
stmt
;
drop
prepare
stmt
;
insert
into
t1
values
(
1
,
1
),
(
1
,
2
),
(
1
,
3
),
(
4
,
4
),
(
5
,
5
);
insert
into
t2
values
(
1
,
2
),
(
2
,
1
),
(
3
,
1
);
set
@
t0
=
now
(
6
);
select
t1
.
x
as
IJ1_x1
,
t1
.
y
as
y1
,
t2
.
x
as
x2
,
t2
.
y
as
y2
from
t1
inner
join
t2
on
t1
.
x
=
t2
.
x
;
select
t1
.
x
as
LJ1_x1
,
t1
.
y
as
y1
,
t2
.
x
as
x2
,
t2
.
y
as
y2
from
t1
left
join
t2
on
t1
.
x
=
t2
.
x
;
select
t1
.
x
as
RJ1_x1
,
t1
.
y
as
y1
,
t2
.
x
as
x2
,
t2
.
y
as
y2
from
t1
right
join
t2
on
t1
.
x
=
t2
.
x
;
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
...
...
sql/sql_yacc.yy
View file @
eff649eb
...
...
@@ -8712,6 +8712,16 @@ opt_for_system_time_clause:
MYSQL_YYABORT;
Lex->current_select->vers_conditions.init(FOR_SYSTEM_TIME_AS_OF, UNIT_TIMESTAMP, item);
}
| FOR_SYSTEM_TIME_SYM ALL
{
static MYSQL_TIME min= { TIMESTAMP_MIN_YEAR, 1, 1, 0, 0, 0, 0, false, MYSQL_TIMESTAMP_DATETIME };
static MYSQL_TIME max= { TIMESTAMP_MAX_YEAR, 12, 31, 23, 59, 59, 0, false, MYSQL_TIMESTAMP_DATETIME };
Item *t0= new (thd->mem_root) Item_datetime_literal(thd, &min);
Item *t1= new (thd->mem_root) Item_datetime_literal(thd, &max);
if (!t0 || !t1)
MYSQL_YYABORT;
Lex->current_select->vers_conditions.init(FOR_SYSTEM_TIME_BETWEEN, UNIT_TIMESTAMP, t0, t1);
}
| FOR_SYSTEM_TIME_SYM
FROM
trans_or_timestamp
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment