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
f1bd02d9
Commit
f1bd02d9
authored
Feb 16, 2018
by
Aleksey Midenkov
Committed by
Sergei Golubchik
Feb 23, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-15004 parser greedily parses AS OF TIMESTAMP
* TIMESTAMP precedence fixed.
parent
e2f70d6e
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
63 additions
and
31 deletions
+63
-31
mysql-test/suite/versioning/r/delete.result
mysql-test/suite/versioning/r/delete.result
+3
-3
mysql-test/suite/versioning/r/foreign.result
mysql-test/suite/versioning/r/foreign.result
+2
-2
mysql-test/suite/versioning/r/select.result
mysql-test/suite/versioning/r/select.result
+11
-1
mysql-test/suite/versioning/r/select2.result
mysql-test/suite/versioning/r/select2.result
+1
-1
mysql-test/suite/versioning/r/view.result
mysql-test/suite/versioning/r/view.result
+1
-1
mysql-test/suite/versioning/t/delete.test
mysql-test/suite/versioning/t/delete.test
+3
-3
mysql-test/suite/versioning/t/foreign.test
mysql-test/suite/versioning/t/foreign.test
+3
-3
mysql-test/suite/versioning/t/select.test
mysql-test/suite/versioning/t/select.test
+8
-1
mysql-test/suite/versioning/t/select2.test
mysql-test/suite/versioning/t/select2.test
+1
-1
mysql-test/suite/versioning/t/view.test
mysql-test/suite/versioning/t/view.test
+1
-1
sql/sql_yacc.yy
sql/sql_yacc.yy
+29
-14
No files found.
mysql-test/suite/versioning/r/delete.result
View file @
f1bd02d9
...
...
@@ -63,7 +63,7 @@ select sys_start into @sys_start from t1;
delete from t1;
select * from t1;
select x = 1 as A, sys_start = @sys_start as B, sys_end > sys_start as C
from t1 for system_time
between timestamp '0-0-0' and timestamp '2038-01-19 04:14:07'
;
from t1 for system_time
all
;
drop table t1;
end~~
create or replace procedure test_03(
...
...
@@ -91,8 +91,8 @@ select x as t2_x from t2;
delete t1, t2 from t1 join t2 where t1.x = t2.x;
select x as t1_x from t1;
select x as t2_x from t2;
select x as t1_x_all from t1 for system_time
between timestamp '0-0-0' and timestamp '2038-01-19 04:14:07'
;
select x as t2_x_all from t2 for system_time
between timestamp '0-0-0' and timestamp '2038-01-19 04:14:07'
;
select x as t1_x_all from t1 for system_time
all
;
select x as t2_x_all from t2 for system_time
all
;
drop table t1;
drop table t2;
end~~
...
...
mysql-test/suite/versioning/r/foreign.result
View file @
f1bd02d9
...
...
@@ -25,7 +25,7 @@ update parent set id=id+1;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`child`, CONSTRAINT `child_ibfk_1` FOREIGN KEY (`parent_id`) REFERENCES `parent` (`id`))
delete from child;
update parent set id=id+1;
select * from child for system_time from timestamp
'1-1-1'
to timestamp now(6);
select * from child for system_time from timestamp
0
to timestamp now(6);
parent_id
1
1
...
...
@@ -165,7 +165,7 @@ delete from child where parent_id = 1;
delete from parent where id = 1;
select * from child;
parent_id
select * from child for system_time from timestamp
'1-1-1'
to timestamp now(6);
select * from child for system_time from timestamp
0
to timestamp now(6);
parent_id
1
1
...
...
mysql-test/suite/versioning/r/select.result
View file @
f1bd02d9
...
...
@@ -248,7 +248,7 @@ a b
select * from (select * from (select * from t1 cross join t2) as tmp1) as tmp2;
a b
1 2
select * from (select * from t1 cross join t2 for system_time as of timestamp
'0-0-0'
) as tmp;
select * from (select * from t1 cross join t2 for system_time as of timestamp
('0-0-0')
) as tmp;
a b
create or replace table t1(a1 int) with system versioning;
create or replace table t2(a2 int) with system versioning;
...
...
@@ -475,6 +475,16 @@ f1 f2 f3 f1 f2 f3 f4
3 3 NULL NULL 3 1 1
3 3 NULL NULL 3 2 1
4 NULL NULL NULL NULL NULL NULL
### MDEV-15004 parser greedily parses AS OF TIMESTAMP
select timestamp'2016-02-30 08:07:06';
ERROR HY000: Incorrect DATETIME value: '2016-02-30 08:07:06'
select * from t1 for system_time as of timestamp'2016-02-30 08:07:06';
ERROR HY000: Incorrect DATETIME value: '2016-02-30 08:07:06'
select timestamp('2003-12-31 12:00:00','12:00:00');
timestamp('2003-12-31 12:00:00','12:00:00')
2004-01-01 00:00:00
select * from t1 for system_time as of timestamp('2003-12-31 12:00:00','12:00:00');
f1
drop view v1;
drop table t1, t2, t3, t4;
call verify_vtq_dummy(34);
...
...
mysql-test/suite/versioning/r/select2.result
View file @
f1bd02d9
...
...
@@ -273,7 +273,7 @@ a b
select * from (select * from (select * from t1 cross join t2) as tmp1) as tmp2;
a b
1 2
select * from (select * from t1 cross join t2 for system_time as of timestamp
'0-0-0'
) as tmp;
select * from (select * from t1 cross join t2 for system_time as of timestamp
('0-0-0')
) as tmp;
a b
create or replace table t1(a1 int) with system versioning;
create or replace table t2(a2 int) with system versioning;
...
...
mysql-test/suite/versioning/r/view.result
View file @
f1bd02d9
...
...
@@ -79,7 +79,7 @@ create or replace view vt12 as select * from t1 cross join t2;
select * from vt12;
a b
1 2
create or replace view vt12 as select * from t1 for system_time as of timestamp
'0-0-0'
cross join t2;
create or replace view vt12 as select * from t1 for system_time as of timestamp
('0-0-0')
cross join t2;
select * from vt12;
a b
# VIEW improvements [#183]
...
...
mysql-test/suite/versioning/t/delete.test
View file @
f1bd02d9
...
...
@@ -67,7 +67,7 @@ begin
delete
from
t1
;
select
*
from
t1
;
select
x
=
1
as
A
,
sys_start
=
@
sys_start
as
B
,
sys_end
>
sys_start
as
C
from
t1
for
system_time
between
timestamp
'0-0-0'
and
timestamp
'2038-01-19 04:14:07'
;
from
t1
for
system_time
all
;
drop
table
t1
;
end
~~
...
...
@@ -96,8 +96,8 @@ begin
delete
t1
,
t2
from
t1
join
t2
where
t1
.
x
=
t2
.
x
;
select
x
as
t1_x
from
t1
;
select
x
as
t2_x
from
t2
;
select
x
as
t1_x_all
from
t1
for
system_time
between
timestamp
'0-0-0'
and
timestamp
'2038-01-19 04:14:07'
;
select
x
as
t2_x_all
from
t2
for
system_time
between
timestamp
'0-0-0'
and
timestamp
'2038-01-19 04:14:07'
;
select
x
as
t1_x_all
from
t1
for
system_time
all
;
select
x
as
t2_x_all
from
t2
for
system_time
all
;
drop
table
t1
;
drop
table
t2
;
end
~~
...
...
mysql-test/suite/versioning/t/foreign.test
View file @
f1bd02d9
...
...
@@ -33,7 +33,7 @@ insert into child values(1);
update
parent
set
id
=
id
+
1
;
delete
from
child
;
update
parent
set
id
=
id
+
1
;
select
*
from
child
for
system_time
from
timestamp
'1-1-1'
to
timestamp
now
(
6
);
select
*
from
child
for
system_time
from
timestamp
0
to
timestamp
now
(
6
);
drop
table
child
;
drop
table
parent
;
...
...
@@ -188,7 +188,7 @@ delete from child where parent_id = 1;
--
echo
## FIXME END
delete
from
parent
where
id
=
1
;
select
*
from
child
;
select
*
from
child
for
system_time
from
timestamp
'1-1-1'
to
timestamp
now
(
6
);
select
*
from
child
for
system_time
from
timestamp
0
to
timestamp
now
(
6
);
delete
from
child
;
insert
into
parent
values
(
1
);
...
...
@@ -198,7 +198,7 @@ if (0)
{
update
parent
set
id
=
id
+
1
;
select
*
from
child
;
select
*
from
child
for
system_time
from
timestamp
'1-1-1'
to
timestamp
now
(
6
);
select
*
from
child
for
system_time
from
timestamp
0
to
timestamp
now
(
6
);
}
## FIXME END
...
...
mysql-test/suite/versioning/t/select.test
View file @
f1bd02d9
...
...
@@ -159,7 +159,7 @@ insert into t1 values (1);
insert
into
t2
values
(
2
);
select
*
from
(
select
*
from
t1
cross
join
t2
)
as
tmp
;
select
*
from
(
select
*
from
(
select
*
from
t1
cross
join
t2
)
as
tmp1
)
as
tmp2
;
select
*
from
(
select
*
from
t1
cross
join
t2
for
system_time
as
of
timestamp
'0-0-0'
)
as
tmp
;
select
*
from
(
select
*
from
t1
cross
join
t2
for
system_time
as
of
timestamp
(
'0-0-0'
)
)
as
tmp
;
create
or
replace
table
t1
(
a1
int
)
with
system
versioning
;
create
or
replace
table
t2
(
a2
int
)
with
system
versioning
;
...
...
@@ -297,6 +297,13 @@ select * from
left
join
t2
as
t2a
left
join
(
t3
as
t3a
inner
join
t1
)
on
t2a
.
f2
=
t3a
.
f3
on
t1a
.
f1
=
t2a
.
f2
left
join
(
t2
join
t3
inner
join
t4
)
on
t2a
.
f2
=
t1a
.
f1
;
--
echo
### MDEV-15004 parser greedily parses AS OF TIMESTAMP
--
error
ER_WRONG_VALUE
select
timestamp
'2016-02-30 08:07:06'
;
--
error
ER_WRONG_VALUE
select
*
from
t1
for
system_time
as
of
timestamp
'2016-02-30 08:07:06'
;
select
timestamp
(
'2003-12-31 12:00:00'
,
'12:00:00'
);
select
*
from
t1
for
system_time
as
of
timestamp
(
'2003-12-31 12:00:00'
,
'12:00:00'
);
drop
view
v1
;
drop
table
t1
,
t2
,
t3
,
t4
;
...
...
mysql-test/suite/versioning/t/select2.test
View file @
f1bd02d9
...
...
@@ -168,7 +168,7 @@ insert into t1 values (1);
insert
into
t2
values
(
2
);
select
*
from
(
select
*
from
t1
cross
join
t2
)
as
tmp
;
select
*
from
(
select
*
from
(
select
*
from
t1
cross
join
t2
)
as
tmp1
)
as
tmp2
;
select
*
from
(
select
*
from
t1
cross
join
t2
for
system_time
as
of
timestamp
'0-0-0'
)
as
tmp
;
select
*
from
(
select
*
from
t1
cross
join
t2
for
system_time
as
of
timestamp
(
'0-0-0'
)
)
as
tmp
;
create
or
replace
table
t1
(
a1
int
)
with
system
versioning
;
create
or
replace
table
t2
(
a2
int
)
with
system
versioning
;
...
...
mysql-test/suite/versioning/t/view.test
View file @
f1bd02d9
...
...
@@ -65,7 +65,7 @@ insert into t1 values (1);
insert
into
t2
values
(
2
);
create
or
replace
view
vt12
as
select
*
from
t1
cross
join
t2
;
select
*
from
vt12
;
create
or
replace
view
vt12
as
select
*
from
t1
for
system_time
as
of
timestamp
'0-0-0'
cross
join
t2
;
create
or
replace
view
vt12
as
select
*
from
t1
for
system_time
as
of
timestamp
(
'0-0-0'
)
cross
join
t2
;
select
*
from
vt12
;
--
echo
# VIEW improvements [#183]
...
...
sql/sql_yacc.yy
View file @
f1bd02d9
...
...
@@ -884,10 +884,10 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%parse-param { THD *thd }
%lex-param { THD *thd }
/*
Currently there are 1
25
shift/reduce conflicts.
Currently there are 1
39
shift/reduce conflicts.
We should not introduce new conflicts any more.
*/
%expect 1
25
%expect 1
39
/*
Comments for TOKENS.
...
...
@@ -1776,6 +1776,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
percentile_function
inverse_distribution_function_def
function_call_keyword
function_call_keyword_timestamp
function_call_nonkeyword
function_call_generic
function_call_conflict kill_expr
...
...
@@ -9200,7 +9201,15 @@ opt_history_unit:
;
history_point:
opt_history_unit simple_expr
temporal_literal
{
$$= Vers_history_point(VERS_TIMESTAMP, $1);
}
| function_call_keyword_timestamp
{
$$= Vers_history_point(VERS_TIMESTAMP, $1);
}
| opt_history_unit simple_expr
{
$$= Vers_history_point($1, $2);
}
...
...
@@ -10099,6 +10108,21 @@ simple_expr:
}
;
function_call_keyword_timestamp:
TIMESTAMP '(' expr ')'
{
$$= new (thd->mem_root) Item_datetime_typecast(thd, $3,
AUTO_SEC_PART_DIGITS);
if ($$ == NULL)
MYSQL_YYABORT;
}
| TIMESTAMP '(' expr ',' expr ')'
{
$$= new (thd->mem_root) Item_func_add_time(thd, $3, $5, 1, 0);
if ($$ == NULL)
MYSQL_YYABORT;
}
;
/*
Function call syntax using official SQL 2003 keywords.
Because the function name is an official token,
...
...
@@ -10222,18 +10246,9 @@ function_call_keyword:
if ($$ == NULL)
MYSQL_YYABORT;
}
| TIMESTAMP '(' expr ')'
{
$$= new (thd->mem_root) Item_datetime_typecast(thd, $3,
AUTO_SEC_PART_DIGITS);
if ($$ == NULL)
MYSQL_YYABORT;
}
| TIMESTAMP '(' expr ',' expr ')'
| function_call_keyword_timestamp
{
$$= new (thd->mem_root) Item_func_add_time(thd, $3, $5, 1, 0);
if ($$ == NULL)
MYSQL_YYABORT;
$$= $1;
}
| TRIM '(' expr ')'
{
...
...
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