Re: EXPLAIN Verbose issue - custom_scan_tlist can directly refer CTE and Subquery

From: "Lepikhov Andrei" <lepikhov(at)fastmail(dot)com>
To: "Richard Guo" <guofenglinux(at)gmail(dot)com>
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Алена Рыбакина <a(dot)rybakina(at)postgrespro(dot)ru>, Дамир Белялов <d(dot)belyalov(at)postgrespro(dot)ru>
Subject: Re: EXPLAIN Verbose issue - custom_scan_tlist can directly refer CTE and Subquery
Date: 2023-09-14 04:58:39
Message-ID: 545bcd8f-7789-4054-bea1-44e2584a305a@app.fastmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message PG Bug reporting form 2023-09-14 07:28:44 BUG #18107: "policy ... for table ... already exists" errors when restore postgres database from dump
Previous Message Andres Freund 2023-09-14 03:30:05 Re: BUG #18046: stats collection behaviour change is affecting the usability of information.