mirror of
https://github.com/MariaDB/server.git
synced 2025-09-02 09:41:40 +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:
@@ -2875,3 +2875,25 @@ f
|
||||
2
|
||||
set standard_compliant_cte=default;
|
||||
DROP TABLE t;
|
||||
#
|
||||
# mdev-14184: recursive CTE embedded into CTE with multiple references
|
||||
#
|
||||
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;
|
||||
n
|
||||
1
|
||||
2
|
||||
3
|
||||
|
Reference in New Issue
Block a user