Do Redshift tables with SUPER data type support joins with recursive CTEs?

0

This sql in Redshift

WITH RECURSIVE

item_array AS (
    SELECT JSON_PARSE('[7, 8, 9]') AS items
),

idx_array(idx) AS (
SELECT 1 AS idx
UNION ALL
SELECT idx + 1 AS idx
FROM idx_array
WHERE idx < 2
)

SELECT
    items[0]
FROM item_array
CROSS JOIN idx_array

produces the error

[XX000] ERROR: Query unsupported due to an internal error. Detail: Unsupported query. Where: RTE kind: 11.

But if CROSS JOIN idx_array line removed, it works.

Can we not join tables with SUPER types in Recursive CTEs?

vida
질문됨 2년 전1385회 조회
1개 답변
0

Hi, The problem seems to be in the select statement and not cross join. If I use the below statement instead, cross join works as expected.

WITH RECURSIVE

item_array AS ( SELECT JSON_PARSE('[7, 8, 9]') AS items ),

idx_array(idx) AS ( SELECT 1 AS idx UNION ALL SELECT idx + 1 AS idx FROM idx_array WHERE idx < 2 )

SELECT * FROM item_array CROSS JOIN idx_array;

It gives me

items | idx

---------+-----

[7,8,9] | 1

[7,8,9] | 2

(2 rows)

AWS
지원 엔지니어
답변함 2년 전
  • Firstly, thank you for looking into this! It works with SELECT * or SELECT items. But when you index items as in SELECT items[0], it fails. So, does that mean items is no longer SUPER?; which goes back to the original question whether SUPER types are not supported with recursive CTEs. Thank you!

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠