pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: torikoshia <torikoshia@oss.nttdata.com>
Cc: Pgsql Hackers <pgsql-hackers@postgresql.org>
Cc: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
Subject: Re: EXPLAIN(VERBOSE) to CTE with SEARCH BREADTH FIRST fails
Date: Tue, 07 Sep 2021 14:31:33 -0400
Message-ID: <3208199.1631039493@sss.pgh.pa.us> (raw)
In-Reply-To: <5bafa66ad529e11860339565c9e7c166@oss.nttdata.com>
References: <5bafa66ad529e11860339565c9e7c166@oss.nttdata.com>

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





view thread (16+ messages)  latest in thread

Message-ID: <3208199.1631039493@sss.pgh.pa.us>
Permalink:  ../3208199.1631039493@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/3208199.1631039493@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, torikoshia@oss.nttdata.com, peter.eisentraut@enterprisedb.com
  Subject: Re: EXPLAIN(VERBOSE) to CTE with SEARCH BREADTH FIRST fails
  In-Reply-To: <3208199.1631039493@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox