Links
Comment on page

MSCEWI1077

Cycle found between CTE calls. CTEs cannot be ordered.

Severity

Low

Description

This warning is added when a query that has several CTE (Common Table Expression) reference calls creates a cycle that cannot determine the calling order of the CTEs, and then the CTEs cannot be ordered and the query will remain as the original source.

Example Code

Teradata:

WITH t1(c1) as (SELECT c1 FROM t2),
t2(c2) as (SELECT c2 FROM t3),
RECURSIVE t3(c3) as (SELECT c3, someOtherColumn FROM t1, t3)
SELECT * FROM t1;

Snowflake:

/*** MSC-WARNING - MSCEWI1077 - CYCLE FOUND BETWEEN CTE REFERENCE CALLS, CTES CANNOT BE ORDERED AND THE QUERY WILL REMAIN AS ORIGINAL ***/
WITH RECURSIVE t1(c1) AS
(
SELECT c1 FROM t2
),
t2(c2) AS
(
SELECT c2 FROM t3
),
t3(c3) AS
(
SELECT c3, someOtherColumn FROM t1, t3
)
SELECT * FROM t1;

Recommendations

  • No additional user actions are required.
  • If you need more support, you can email us at [email protected]