Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
10.2(EOL)
-
None
Description
Hi,
When trying to find a workaround for jira MDEV-13730, I generated a new code which does not use too many CTEs in the same scope.
This is a sample new SQL code :
and when executed, it outputs the error :
1146, "Table 'db.DT_node_lookup' doesn't exist"
There is no such table, but a CTE is defined in the SQL code with the same name.
At first, the last error seems to be a CTE resolution issue when CTEs are defined inside CTEs.
I am working on debian, with a mariadb version 10.2.8.
Thanks in advance
Antoine
Attachments
Issue Links
- relates to
-
MDEV-14184 recursive CTE not found
-
- Closed
-
The following simple test case demonstrates this problem:
create table t1 (a int);
insert into t1 values (3), (2), (4), (7), (1), (2), (5);
with cte_o as ( with cte_i as (select * from t1 where a < 7) select * from cte_i where a > 1 )
select * from cte_o as cto_o1 where a < 3 union select * from cte_o as cto_o2 where a > 4;
When running the above query we get:
MariaDB [test]> with cte_o as ( with cte_i as (select * from t1 where a < 7) select * from cte_i where a > 1 )
-> select * from cte_o as cto_o1 where a < 3 union select * from cte_o as cto_o2 where a > 4;
ERROR 1146 (42S02): Table 'test.cte_i' doesn't exist