Details
-
Bug
-
Status: In Review (View Workflow)
-
Major
-
Resolution: Unresolved
-
10.11, 11.4, 11.8, 12.3, 13.1, 12.3.4
-
Ubuntu 24.04
MariaDB Server
-
Unexpected results
Description
MariaDB incorrectly reports an existing CTE column as unknown when the column order in the CYCLE clause differs from the CTE output column order.
Steps to reproduce:
1. Execute the following query:
WITH RECURSIVE cte(a, b) AS (
SELECT 1, 10
)
CYCLE a, b RESTRICT
SELECT * FROM cte;
Result:
The query executes successfully and returns one row: (1, 10).
2. Execute the same query with the CYCLE columns in reverse order:
WITH RECURSIVE cte(a, b) AS (
SELECT 1, 10
)
CYCLE b, a RESTRICT
SELECT * FROM cte;
Actual result:
ERROR 1054 (42S22): Unknown column 'a' in 'CYCLE clause'
Expected result:
Both queries should execute successfully because columns a and b are explicitly defined in the CTE. Changing their order in the CYCLE clause should not produce an unknown-column error.
Attachments
Issue Links
- relates to
-
MDEV-20632 Recursive CTE cycle detection using CYCLE clause (nonstandard)
-
- Closed
-