pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andrey Lepikhov <a.lepikhov@postgrespro.ru>
To: Richard Guo <guofenglinux@gmail.com>
To: Lepikhov Andrei <lepikhov@fastmail.com>
Cc: pgsql-bugs@lists.postgresql.org, tgl@sss.pgh.pa.us, Алена Рыбакина <a.rybakina@postgrespro.ru>
Cc: Дамир Белялов <d.belyalov@postgrespro.ru>
Subject: Re: EXPLAIN Verbose issue - custom_scan_tlist can directly refer CTE and Subquery
Date: Thu, 28 Sep 2023 13:32:25 +0700
Message-ID: <ca3f78bc-9775-4c12-97b5-5e03282df3ea@postgrespro.ru> (raw)
In-Reply-To: <CAMbWs49A1VegrUX08on3WdH7b7t7FUE15JT4qk_vsQ_qfHMGhQ@mail.gmail.com>
References: <dfe47e78-f9c3-4f59-a345-591f7fd3ceec@app.fastmail.com>
	<CAMbWs49A1VegrUX08on3WdH7b7t7FUE15JT4qk_vsQ_qfHMGhQ@mail.gmail.com>

On 11/9/2023 13:28, Richard Guo wrote:
> So it seems that we need to assign a proper INNER referent for
> CustomScan node in set_deparse_plan().  I tried 'trick.diff' in [1]
> which uses linitial(dpns->subplans), it fixes the query there but would
> crash the query below.
> 
> explain (verbose, costs off)
> select (rr).column2 from
>    (select r from (values(1,2),(3,4)) r) s join
>    (select rr from (values(1,7),(3,8)) rr limit 2) ss
>    on (r).column1 = (rr).column1;
> server closed the connection unexpectedly
> 
> Maybe we can use the first plan in CustomScan->custom_plans as the INNER
> referent?  I'm not sure.

Looking into this issue more, I figured out that we can't be sure from 
which side the current varno of custom_scan_tlist was produced: from 
inner, outer or one of the custom subplans. In one of my previous R&D 
projects, I remember that the CustomScan node received tuples from the 
network, gathering them from other pg-instances.
So, as we already have an optional ExplainCustomScan routine, maybe add 
one more for the show_plan_tlist routine? It can print a target list or 
ignore it as the Append node does.

-- 
regards,
Andrey Lepikhov
Postgres Professional






view thread (7+ messages)  latest in thread

Message-ID: <ca3f78bc-9775-4c12-97b5-5e03282df3ea@postgrespro.ru>
Permalink:  ../ca3f78bc-9775-4c12-97b5-5e03282df3ea@postgrespro.ru/
Also on:    postgresql.org/message-id/ca3f78bc-9775-4c12-97b5-5e03282df3ea@postgrespro.ru

 · 

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-bugs@postgresql.org
  Cc: a.lepikhov@postgrespro.ru, guofenglinux@gmail.com, lepikhov@fastmail.com, a.rybakina@postgrespro.ru, d.belyalov@postgrespro.ru
  Subject: Re: EXPLAIN Verbose issue - custom_scan_tlist can directly refer CTE and Subquery
  In-Reply-To: <ca3f78bc-9775-4c12-97b5-5e03282df3ea@postgrespro.ru>

* 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