Details
-
Bug
-
Resolution: Done
-
Major
-
8.12.x
-
None
Description
When running a recursive common table expression query against a source that does not support recursive cte pushdown, only the recursive part of the query is pushed, which fails, since it references a non-existent table (the cte).
E. g. the query
WITH tmp_cte(id, fk, lvl) AS ( SELECT id, fk, 0 as lvl FROM SourceModel.cte_source WHERE fk IS NULL UNION ALL SELECT e.id, e.fk, lvl + 1 as lvl FROM SourceModel.cte_source AS e INNER JOIN tmp_cte AS ecte ON ecte.id = e.fk ) SELECT * FROM tmp_cte
against a PostreSQL source results in
Remote org.postgresql.util.PSQLException: ERROR: relation "tmp_cte" does not exist
because this query is pushed down:
SELECT g_0.id, g_0.fk, g_0.lvl FROM tmp_cte AS g_0