Re: EXPLAIN(VERBOSE) to CTE with SEARCH BREADTH FIRST fails - Mailing list pgsql-hackers

From Tom Lane
Subject Re: EXPLAIN(VERBOSE) to CTE with SEARCH BREADTH FIRST fails
Date
Msg-id 3208199.1631039493@sss.pgh.pa.us
Whole thread Raw
In response to EXPLAIN(VERBOSE) to CTE with SEARCH BREADTH FIRST fails  (torikoshia <torikoshia@oss.nttdata.com>)
Responses Re: EXPLAIN(VERBOSE) to CTE with SEARCH BREADTH FIRST fails  (Peter Eisentraut <peter.eisentraut@enterprisedb.com>)
List 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



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: .ready and .done files considered harmful
Next
From: "Bossart, Nathan"
Date:
Subject: Re: .ready and .done files considered harmful