Skip to content

opt: Unexpected error when using recursive CTE #45869

@andy-kimball

Description

@andy-kimball

REPRO:

root@:26257/defaultdb> with recursive x(a) as
  ((values ('a'), ('b'))
   union all
   (with z as (select * from x)
    select z.a || z.a as a from z cross join z as z1
    where length(z.a) < 3))
select * from x;

ERROR: couldn't find WITH expression "x" with ID 1
HINT: references to WITH expressions from correlated subqueries are unsupported

EXPECTED: No error, PG is able to run this query.

Metadata

Metadata

Assignees

Labels

C-bugCode not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.S-3-ux-surpriseIssue leaves users wondering whether CRDB is behaving properly. Likely to hurt reputation/adoption.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions