summaryrefslogtreecommitdiff
path: root/mysql-test/t/cte_nonrecursive.test
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2016-07-29 01:10:00 -0700
committerIgor Babaev <igor@askmonty.org>2016-07-29 01:10:00 -0700
commit247632e67ea49227978cfc50f4df6274ccda4a33 (patch)
tree8648162c3bf40059b4830c1b9c2770aad23d864c /mysql-test/t/cte_nonrecursive.test
parentf982d1074a3bc880462ab2372803b278af8dc4dd (diff)
downloadmariadb-git-247632e67ea49227978cfc50f4df6274ccda4a33.tar.gz
Fixed bug mdev-10344.
The patch for bug mdev-9937 actually did not fix the problem of name resolution for tables used in views referred in queries with WITH clauses. This fix corrects the patch.
Diffstat (limited to 'mysql-test/t/cte_nonrecursive.test')
-rw-r--r--mysql-test/t/cte_nonrecursive.test18
1 files changed, 18 insertions, 0 deletions
diff --git a/mysql-test/t/cte_nonrecursive.test b/mysql-test/t/cte_nonrecursive.test
index 9a0e43bf8f7..8caf0832df4 100644
--- a/mysql-test/t/cte_nonrecursive.test
+++ b/mysql-test/t/cte_nonrecursive.test
@@ -471,3 +471,21 @@ SELECT * FROM (WITH a AS (SELECT * FROM t1) SELECT * FROM t2 NATURAL JOIN t3) AS
DROP TABLE t1,t2,t3;
+--echo #
+--echo # Bug mdev-10344: the WITH clause of the query refers to a view that uses
+--echo # a base table with the same name as a CTE table from the clause
+--echo #
+
+
+create table ten(a int primary key);
+insert into ten values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+
+create table one_k(a int primary key);
+insert into one_k select A.a + B.a* 10 + C.a * 100 from ten A, ten B, ten C;
+
+create view v1 as select * from ten;
+
+select * from v1;
+
+drop view v1;
+drop table ten, one_k;