From: Lepikhov Andrei <lepikhov@fastmail.com>
To: Richard Guo <guofenglinux@gmail.com>
Cc: pgsql-bugs@lists.postgresql.org, "Tom Lane" <tgl@sss.pgh.pa.us>
Cc: Алена Рыбакина <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, 14 Sep 2023 11:58:39 +0700
Message-ID: <545bcd8f-7789-4054-bea1-44e2584a305a@app.fastmail.com> (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 Mon, Sep 11, 2023, at 1:28 PM, Richard Guo wrote:
> Maybe we can use the first plan in CustomScan->custom_plans as the INNER
> referent? I'm not sure.
After some exploration of ruleutils.c I grasped more on this issue.
If we have come to the CTE or SubPlan entry by the INDEX_VAR link from custom_scan_tlist, we don't have any information on which subplan to go further (entry info already removed because of optimization).
To find a specific subplan, we must pass through the custom node subtree and find CteScan or SubqueryScan, whose target list refers to this entry. After that, we can go into the subplan to correctly explain the var.
It looks like a lot of work. One vague idea is to change set_customscan_references and wrap up CustomScan with useful data.
Or, maybe it is better not to try to go under the custom_scan_tlist and explain CTE and Subquery right on the level of the CustomScan?
--
Regards,
Andrei Lepikhov
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: lepikhov@fastmail.com, guofenglinux@gmail.com, tgl@sss.pgh.pa.us, 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: <545bcd8f-7789-4054-bea1-44e2584a305a@app.fastmail.com>
* 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