summaryrefslogtreecommitdiff
path: root/mysql-test/t/cte_recursive.test
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2017-04-22 23:45:38 -0700
committerIgor Babaev <igor@askmonty.org>2017-04-22 23:45:38 -0700
commitd66c171e0fd42ded18a75308f1df2afa0d31787e (patch)
treec19fae220cbfbbac9129a8c9ef57e3ea6d3717ba /mysql-test/t/cte_recursive.test
parent54a995cd2206995f6dd675cabdce12a4b7ff7540 (diff)
downloadmariadb-git-d66c171e0fd42ded18a75308f1df2afa0d31787e.tar.gz
Fixed the bug mdev-12554.
When the WHERE condition is always FALSE then JOIN::join_tab is NULL.
Diffstat (limited to 'mysql-test/t/cte_recursive.test')
-rw-r--r--mysql-test/t/cte_recursive.test12
1 files changed, 12 insertions, 0 deletions
diff --git a/mysql-test/t/cte_recursive.test b/mysql-test/t/cte_recursive.test
index 26dbe2bccc0..fe59d4a2461 100644
--- a/mysql-test/t/cte_recursive.test
+++ b/mysql-test/t/cte_recursive.test
@@ -1834,3 +1834,15 @@ drop table objects, modules, module_arguments, module_results;
set standard_compliant_cte=default;
select @@standard_compliant_cte;
+--echo #
+--echo # mdev-12554: impossible where in recursive select
+--echo #
+
+CREATE TABLE t1 (i int);
+INSERT INTO t1 VALUES (1),(2);
+
+WITH RECURSIVE
+cte(f) AS ( SELECT i FROM t1 UNION SELECT f FROM t1, cte WHERE 1=0 )
+SELECT * FROM cte;
+
+DROP TABLE t1;