From 4a8d3771718b6bdce4604fa310bd968ca38eb7a2 Mon Sep 17 00:00:00 2001 From: Igor Babaev Date: Mon, 16 May 2016 20:19:04 -0700 Subject: Fixed bug mdev-10058. This was a bug in the parser. As a result it could accept queries with invalid derived tables if they used With clauses. --- mysql-test/r/cte_nonrecursive.result | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'mysql-test/r/cte_nonrecursive.result') diff --git a/mysql-test/r/cte_nonrecursive.result b/mysql-test/r/cte_nonrecursive.result index a9c13f3f10b..c1f2739bd97 100644 --- a/mysql-test/r/cte_nonrecursive.result +++ b/mysql-test/r/cte_nonrecursive.result @@ -759,3 +759,20 @@ a 30 drop view v1; drop table t1; +# +# Bug mdev-10058: Invalid derived table with WITH clause +# +CREATE TABLE t1 (a INT); +CREATE TABLE t2 (a INT); +CREATE TABLE t3 (a INT); +INSERT INTO t1 VALUES (1),(2),(3); +INSERT INTO t2 VALUES (1),(2),(3); +INSERT INTO t3 VALUES (1),(2),(3); +SELECT * FROM (WITH a AS (SELECT * FROM t1) (t2 NATURAL JOIN t3)); +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 't2 NATURAL JOIN t3))' at line 1 +SELECT * FROM (WITH a AS (SELECT * FROM t1) SELECT * FROM t2 NATURAL JOIN t3) AS d1; +a +1 +2 +3 +DROP TABLE t1,t2,t3; -- cgit v1.2.1