Re: EXPLAIN(VERBOSE) to CTE with SEARCH BREADTH FIRST fails
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: torikoshia <torikoshia@oss.nttdata.com>
Cc: Pgsql Hackers <pgsql-hackers@postgresql.org>,
Peter Eisentraut <peter.eisentraut@enterprisedb.com>
Date: 2021-09-07T18:31:33Z
Lists: pgsql-hackers
torikoshia <torikoshia@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
Commits
-
Fix EXPLAIN of SEARCH BREADTH FIRST queries some more.
- 39ae0ef85613 15.0 landed
- 2c25db32eedb 14.1 landed
-
Fix EXPLAIN to handle SEARCH BREADTH FIRST queries.
- 3f50b8263963 15.0 landed
- 388726753b63 14.0 landed
-
Message style improvements
- 4ac0f450b698 15.0 cited