]
Steven Hawkins resolved TEIID-4135.
-----------------------------------
Fix Version/s: 9.0
8.12.5
Resolution: Done
The issue here is if the anchor can be pushed, but the entire cte cannot be. The planner
still proceeded to allow the temporary cte group to be seen as associated with the source.
The new logic will replan if recursive query if both parts cannot be pushed.
Invalid query when using recursive CTE with translators that do not
suport RCTE pushdown
----------------------------------------------------------------------------------------
Key: TEIID-4135
URL:
https://issues.jboss.org/browse/TEIID-4135
Project: Teiid
Issue Type: Bug
Components: JDBC Connector
Affects Versions: 8.12.x
Reporter: Andrej Šmigala
Assignee: Steven Hawkins
Fix For: 9.0, 8.12.5
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
{code:sql}
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
{code}
against a PostreSQL source results in {noformat}Remote org.postgresql.util.PSQLException:
ERROR: relation "tmp_cte" does not exist{noformat}
because this query is pushed down:
{code:sql}SELECT g_0.id, g_0.fk, g_0.lvl FROM tmp_cte AS g_0{code}