diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2020-06-07 12:22:06 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2020-06-07 12:22:06 +0300 |
commit | 0e69f601aaafb920a9305c4ab5d380de2b43e917 (patch) | |
tree | f5e301b1f6e317b7efcaf347090fb35aa3cfc892 /mysql-test/main/cte_recursive.test | |
parent | 7ae12371dd420eb7b7fcbd07bd49e2d1b28057d7 (diff) | |
parent | eb14e073ea121954fb5be6fac92fd84b7d57bb07 (diff) | |
download | mariadb-git-0e69f601aaafb920a9305c4ab5d380de2b43e917.tar.gz |
Merge 10.4 into 10.5
Diffstat (limited to 'mysql-test/main/cte_recursive.test')
-rw-r--r-- | mysql-test/main/cte_recursive.test | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/mysql-test/main/cte_recursive.test b/mysql-test/main/cte_recursive.test index ce3b817a937..8bb3d540c87 100644 --- a/mysql-test/main/cte_recursive.test +++ b/mysql-test/main/cte_recursive.test @@ -2571,7 +2571,45 @@ select * from t1 as t; drop table t1,t2; ---echo # End of 10.2 tests + +--echo # +--echo # MDEV-22042: ANALYZE of query using stored function and recursive CTE +--echo # + +create table t1 (a1 varchar(20),a2 varchar(20)) engine=myisam; +insert into t1 values (1,1),(2,2),(3,3); + +create table t2 ( +a2 varchar(20) primary key, b1 varchar(20), key (b1) +) engine=myisam; +insert into t2 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7); +insert into t2 values (11,11),(12,12),(13,13),(14,14),(15,15),(16,16),(17,17); + +delimiter $$; +create function f1(id varchar(20)) returns varchar(50) +begin + declare res varchar (50); + select a2 into res from t2 where a2=id and b1=1 limit 1; + return res; +end$$ +delimiter ;$$ + +let q= +select fv +from (select t1.a1, f1(t1.a2) fv from t1) dt +where (dt.a1) in (with recursive cte as (select a2 from t2 where a2='2' + union select tt2.a2 from t2 tt2 join cte on tt2.b1=cte.a2) +select a2 from cte); + +eval $q; +eval explain $q; +--source include/analyze-format.inc +eval analyze format=json $q; + +drop function f1; +drop table t1,t2; + +--echo End of 10.2 tests --echo # --echo # MDEV-14217 [db crash] Recursive CTE when SELECT includes new field |