Skip to content

SQL Planner doesn't distinguish normal CTEs from the recursive ones. #3713

@isidentical

Description

@isidentical

Describe the bug
Recursive CTE support for datafusion is still in the planning stage, and it is tracked in #462. But the SQL planner still doesn't rejects the recursive CTEs and let them silently fail (or work, depending on the internal implementation).

To Reproduce
Steps to reproduce the behavior:

WITH RECURSIVE numbers(n) AS (
    SELECT 1 as n
  UNION
    SELECT n + 1 as n FROM numbers WHERE n < 10
)
SELECT * FROM numbers;

Running the query above would result with a cryptic error:

Plan("'datafusion.public.numbers' not found")

Expected behavior
It should fail immediately (even before processing the sub-expressions of the CTE) if the RECURSIVE property is used.

Additional context
Implementation regarding recursive CTEs for datafusion is being discussed here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions