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

Fixed bugs: mdev-13780 CTE not found, mdev-14184 recursive CTE not found

The support of embedded CTEs was not correct in the cases when
embedded CTEs were used multiple times. The problems occurred with
both non-recursive (bug mdev-13780) and recursive (bug mdev-14184)
embedded CTEs.
This commit is contained in:
Igor Babaev
2017-11-05 18:45:12 -08:00
parent 8f2e8cf0cb
commit e0cd6f4b07
5 changed files with 133 additions and 7 deletions

View File

@ -1928,3 +1928,22 @@ set standard_compliant_cte=default;
DROP TABLE t;
--echo #
--echo # mdev-14184: recursive CTE embedded into CTE with multiple references
--echo #
WITH
cte1 AS (
SELECT n FROM (
WITH RECURSIVE rec_cte(n) AS (
SELECT 1 as n1
UNION ALL
SELECT n+1 as n2 FROM rec_cte WHERE n < 3
) SELECT n FROM rec_cte
) AS X
),
cte2 as (
SELECT 2 FROM cte1
)
SELECT *
FROM cte1;