summaryrefslogtreecommitdiff
path: root/mysql-test/suite
diff options
context:
space:
mode:
authorAleksey Midenkov <midenok@gmail.com>2018-02-16 19:07:32 +0100
committerSergei Golubchik <serg@mariadb.org>2018-02-23 15:33:23 +0100
commitf1bd02d99416649717c1f73d9f44b3474736f192 (patch)
tree87706ac1e2507051600e3a8feb7a3b0de9743299 /mysql-test/suite
parente2f70d6e101278747967f1caa66ea6bef4082ab3 (diff)
downloadmariadb-git-f1bd02d99416649717c1f73d9f44b3474736f192.tar.gz
MDEV-15004 parser greedily parses AS OF TIMESTAMP
* TIMESTAMP precedence fixed.
Diffstat (limited to 'mysql-test/suite')
-rw-r--r--mysql-test/suite/versioning/r/delete.result6
-rw-r--r--mysql-test/suite/versioning/r/foreign.result4
-rw-r--r--mysql-test/suite/versioning/r/select.result12
-rw-r--r--mysql-test/suite/versioning/r/select2.result2
-rw-r--r--mysql-test/suite/versioning/r/view.result2
-rw-r--r--mysql-test/suite/versioning/t/delete.test6
-rw-r--r--mysql-test/suite/versioning/t/foreign.test6
-rw-r--r--mysql-test/suite/versioning/t/select.test9
-rw-r--r--mysql-test/suite/versioning/t/select2.test2
-rw-r--r--mysql-test/suite/versioning/t/view.test2
10 files changed, 34 insertions, 17 deletions
diff --git a/mysql-test/suite/versioning/r/delete.result b/mysql-test/suite/versioning/r/delete.result
index 79f619fecdd..983df50d676 100644
--- a/mysql-test/suite/versioning/r/delete.result
+++ b/mysql-test/suite/versioning/r/delete.result
@@ -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~~
diff --git a/mysql-test/suite/versioning/r/foreign.result b/mysql-test/suite/versioning/r/foreign.result
index ca2459f784a..1e288e2a176 100644
--- a/mysql-test/suite/versioning/r/foreign.result
+++ b/mysql-test/suite/versioning/r/foreign.result
@@ -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
diff --git a/mysql-test/suite/versioning/r/select.result b/mysql-test/suite/versioning/r/select.result
index 1f7e0306b9b..2ece11fdf6b 100644
--- a/mysql-test/suite/versioning/r/select.result
+++ b/mysql-test/suite/versioning/r/select.result
@@ -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);
diff --git a/mysql-test/suite/versioning/r/select2.result b/mysql-test/suite/versioning/r/select2.result
index 79c4416a291..4ec07b1b69e 100644
--- a/mysql-test/suite/versioning/r/select2.result
+++ b/mysql-test/suite/versioning/r/select2.result
@@ -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;
diff --git a/mysql-test/suite/versioning/r/view.result b/mysql-test/suite/versioning/r/view.result
index f94cf4567db..3a85f918623 100644
--- a/mysql-test/suite/versioning/r/view.result
+++ b/mysql-test/suite/versioning/r/view.result
@@ -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]
diff --git a/mysql-test/suite/versioning/t/delete.test b/mysql-test/suite/versioning/t/delete.test
index 55420a21185..dc228b0db72 100644
--- a/mysql-test/suite/versioning/t/delete.test
+++ b/mysql-test/suite/versioning/t/delete.test
@@ -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~~
diff --git a/mysql-test/suite/versioning/t/foreign.test b/mysql-test/suite/versioning/t/foreign.test
index 81d1caa2594..b9404f12459 100644
--- a/mysql-test/suite/versioning/t/foreign.test
+++ b/mysql-test/suite/versioning/t/foreign.test
@@ -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
diff --git a/mysql-test/suite/versioning/t/select.test b/mysql-test/suite/versioning/t/select.test
index 356406e0947..beadbd5c9a8 100644
--- a/mysql-test/suite/versioning/t/select.test
+++ b/mysql-test/suite/versioning/t/select.test
@@ -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;
diff --git a/mysql-test/suite/versioning/t/select2.test b/mysql-test/suite/versioning/t/select2.test
index 81070a960ee..7baaec3bced 100644
--- a/mysql-test/suite/versioning/t/select2.test
+++ b/mysql-test/suite/versioning/t/select2.test
@@ -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;
diff --git a/mysql-test/suite/versioning/t/view.test b/mysql-test/suite/versioning/t/view.test
index a83820a0419..b63c91c4fa7 100644
--- a/mysql-test/suite/versioning/t/view.test
+++ b/mysql-test/suite/versioning/t/view.test
@@ -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]