1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Merge 10.2 into 10.3

This commit is contained in:
Marko Mäkelä
2020-06-06 18:50:25 +03:00
41 changed files with 1471 additions and 65 deletions

View File

@ -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