Uploaded image for project: 'Teiid'
  1. Teiid
  2. TEIID-4135

Invalid query when using recursive CTE with translators that do not suport RCTE pushdown

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 9.0, 8.12.5
    • 8.12.x
    • JDBC Connector
    • 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

      Attachments

        Activity

          People

            rhn-engineering-shawkins Steven Hawkins
            asmigala@redhat.com Andrej Smigala
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: