diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2021-11-17 13:59:42 +0200 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2021-11-17 13:59:42 +0200 |
commit | 70e788b1e588106f332b88f435e588de3b103e04 (patch) | |
tree | 3a5c74153bb11806b300f2f82d5378aef2d52c02 /mysql-test/main/cte_nonrecursive.test | |
parent | 878f7e38c74baffd1baea00800a6cae0c6c64279 (diff) | |
parent | 9962cda52722b77c2a7e0314bbaa2e4f963f55c1 (diff) | |
download | mariadb-git-70e788b1e588106f332b88f435e588de3b103e04.tar.gz |
Merge 10.3 into 10.4
Diffstat (limited to 'mysql-test/main/cte_nonrecursive.test')
-rw-r--r-- | mysql-test/main/cte_nonrecursive.test | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/mysql-test/main/cte_nonrecursive.test b/mysql-test/main/cte_nonrecursive.test index e1be68563d2..951d7788591 100644 --- a/mysql-test/main/cte_nonrecursive.test +++ b/mysql-test/main/cte_nonrecursive.test @@ -1542,6 +1542,42 @@ call sp(); drop procedure sp; drop table t1; +--echo # +--echo # MDEV-26825: query with two usage of CTE that refers to another CTE +--echo # with stored function using a base table. +--echo # + +create table t1 (id int primary key); +insert into t1 values +(1), (2), (3), (4), (5), (6), (7), (8), (9), (10); + +create function f(in_id int) returns integer +return (select id from t1 where t1.id = in_id); + +with c1 as (select id from t1 where f(id)=id group by id), + c2 as (select id from c1 as pt group by id) +select id from c2 as s1 union select id from c2 as s2; + +with c1 as (select id from t1 as r where f(id)=id group by id), + c2 as (select id from c1 as pt group by id) +select id from c2 as s1 union select id from c2 as s2; + +create function g() returns int return (select count(*) from t1); +create procedure sp1() + +with c1 as (select id from t1 a where g() > 10), + c2 as (select id from c1) +select id from c2 as s1 union select id from c2 as s2; + +call sp1(); +call sp1(); + +drop procedure sp1; +drop function g; + +drop function f; +drop table t1; + --echo # End of 10.2 tests --echo # |