torikoshia <torikos...@oss.nttdata.com> writes: > While working on [1], we found that EXPLAIN(VERBOSE) to CTE with SEARCH > BREADTH FIRST ends up ERROR.
Yeah. It's failing here: * We're deparsing a Plan tree so we don't have a CTE * list. But the only place we'd see a Var directly * referencing a CTE RTE is in a CteScan plan node, and we * can look into the subplan's tlist instead. if (!dpns->inner_plan) elog(ERROR, "failed to find plan for CTE %s", rte->eref->aliasname); The problematic Var is *not* in a CteScan plan node; it's in a WorkTableScan node. It's not clear to me whether this is a bug in the planner's handling of SEARCH BREADTH FIRST, or if the plan is as-intended and ruleutils.c is failing to cope. Either way, this deserves an open item... regards, tom lane