1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

Fixed bug mdev-10889

The bug was in the code of the recursive method
With_element::check_unrestricted_recursive. For recursive
calls of this method sel->get_with_element()->owner != owner.
This commit is contained in:
Igor Babaev
2016-09-26 10:40:44 -07:00
parent 1f1990a161
commit b91bd822fa
3 changed files with 71 additions and 2 deletions

View File

@ -1304,3 +1304,35 @@ WITH RECURSIVE cte(f) AS
(SELECT t1.f FROM t1 UNION ALL SELECT cte.f FROM cte)
SELECT * FROM cte as t;
DROP TABLE t1;
--echo #
--echo # MDEV-10889: mergeable derived in the spec of recursive CTE
--echo #
create table t1 (a int);
insert into t1 values
(0), (1), (2), (3), (4);
create table t2 (a int);
insert into t2 values
(1), (2), (3), (4), (5);
with recursive
t1 as
(
select x.a from (select a from t2 where t2.a=3) x
union
select t2.a from t1,t2 where t1.a+1=t2.a
)
select * from t1;
explain
with recursive
t1 as
(
select x.a from (select a from t2 where t2.a=3) x
union
select t2.a from t1,t2 where t1.a+1=t2.a
)
select * from t1;
drop table t1,t2;