diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2018-07-05 17:08:44 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2018-07-05 17:08:44 +0300 |
commit | b4c377f21510849a67bcb0c72e8715903883ce4d (patch) | |
tree | 2eae0cae1fbf06a07d1e30b0c2c34ffc11d4df3b /mysql-test/main/cte_recursive.result | |
parent | 1748a31ae8d69e4939336f644f884e9de3039e7f (diff) | |
parent | 1b335a74b4ea1944d6ef91113b1a510c0f11c557 (diff) | |
download | mariadb-git-b4c377f21510849a67bcb0c72e8715903883ce4d.tar.gz |
Merge 10.2 into 10.3
Diffstat (limited to 'mysql-test/main/cte_recursive.result')
-rw-r--r-- | mysql-test/main/cte_recursive.result | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/mysql-test/main/cte_recursive.result b/mysql-test/main/cte_recursive.result index 4d1535cacb2..37f77f320ef 100644 --- a/mysql-test/main/cte_recursive.result +++ b/mysql-test/main/cte_recursive.result @@ -3269,6 +3269,64 @@ select 3, 0*(@d:=@d+1) from qn where @d<1 select * from qn; ERROR 42000: This version of MariaDB doesn't yet support 'mix of ALL and DISTINCT UNION operations in recursive CTE spec' drop table t1; +# +# MDEV-16629: function with recursive CTE using a base table +# +CREATE TABLE t1 (id int); +INSERT INTO t1 VALUES (0), (1),(2); +WITH recursive cte AS +(SELECT id FROM t1 UNION SELECT 3 FROM cte) +SELECT count(id) FROM cte; +count(id) +4 +CREATE OR REPLACE FUNCTION func() RETURNS int +RETURN +( +WITH recursive cte AS +(SELECT id FROM t1 UNION SELECT 3 FROM cte) +SELECT count(id) FROM cte +); +SELECT func(); +func() +4 +DROP FUNCTION func; +DROP TABLE t1; +# +# MDEV-16661: function with recursive CTE using no base tables +# (fixed by the patch for MDEV-16629) +# +CREATE OR REPLACE FUNCTION func() RETURNS int +RETURN +( +WITH RECURSIVE cte AS +(SELECT 1 as id UNION SELECT * FROM cte) +SELECT count(id) FROM cte +); +SELECT func(); +func() +1 +DROP FUNCTION func; +# +# MDEV-15151: function with recursive CTE using no base tables +# (duplicate of MDEV-16661) +# +connection default; +CREATE TABLE t1 (id int KEY); +INSERT INTO t1 VALUES (0), (1),(2); +CREATE OR REPLACE FUNCTION func() RETURNS int +RETURN +( +WITH recursive cte AS +(SELECT 1 a UNION SELECT cte.* FROM cte natural join t1) +SELECT * FROM cte limit 1 +); +connect con1,localhost,root,,; +SELECT func(); +connection default; +KILL QUERY 5; +DROP FUNCTION func; +DROP TABLE t1; +disconnect con1; # Start of 10.3 tests # # MDEV-14217 [db crash] Recursive CTE when SELECT includes new field |