Bug 1326842

Summary: Invalid query when using recursive CTE with translators that do not suport RCTE pushdown
Product: [JBoss] JBoss Data Virtualization 6 Reporter: Andrej Smigala <asmigala>
Component: TeiidAssignee: Van Halbert <vhalbert>
Status: CLOSED CURRENTRELEASE QA Contact: Andrej Smigala <asmigala>
Severity: high Docs Contact:
Priority: medium    
Version: 6.3.0CC: aszczucz, blafond, jolee, mbaluch, thauser, vhalbert
Target Milestone: ER3   
Target Release: 6.3.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-08-24 11:43:49 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Andrej Smigala 2016-04-13 13:59:07 UTC
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

Comment 2 JBoss JIRA Server 2016-04-13 19:48:10 UTC
Steven Hawkins <shawkins> updated the status of jira TEIID-4135 to Resolved

Comment 3 JBoss JIRA Server 2016-06-05 23:43:59 UTC
Steven Hawkins <shawkins> updated the status of jira TEIID-4135 to Closed