Re: plan shape work

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Richard Guo <guofenglinux(at)gmail(dot)com>, Alexandra Wang <alexandra(dot)wang(dot)oss(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, "bruce(at)momjian(dot)us" <bruce(at)momjian(dot)us>, lepihov(at)gmail(dot)com
Subject: Re: plan shape work
Date: 2025-09-16 14:17:42
Message-ID: CA+TgmoZVKVt4VrmbYe78dTQYRP7kAhCFmytcs7ayGZapGCdS-A@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Sep 15, 2025 at 3:43 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> anything to the RTE's eref. While that makes your argument
> nominally true, I'd be inclined to argue that this was an oversight
> and it should have changed the alias/eref fields to look like other
> RTE_RESULTs. (I've not investigated, but I wonder what your
> patch prints for such cases.)

It just prints "-> Result" and that's it, as in this example:

robert.haas=# create or replace function absolutely_not() returns bool
return false;
CREATE FUNCTION
robert.haas=# explain (costs off) select * from generate_series(1,3) g
full join absolutely_not() n on true;
QUERY PLAN
------------------------------------------
Merge Full Join
-> Function Scan on generate_series g
-> Materialize
-> Result
(4 rows)

robert.haas=# explain (costs off, range_table) select * from
generate_series(1,3) g full join absolutely_not() n on true;
QUERY PLAN
------------------------------------------
Merge Full Join
-> Function Scan on generate_series g
Scan RTI: 1
-> Materialize
-> Result
RTIs: 2
RTI 1 (function, in-from-clause):
Alias: g ()
Eref: g (g)
WITH ORDINALITY: false
RTI 2 (result, in-from-clause):
Alias: n ()
Eref: n (n)
RTI 3 (join, in-from-clause):
Eref: unnamed_join (g, n)
Join Type: Full
(16 rows)

Here's a new patch set. My main questions are:

1. Did I miss anything you wanted fixed in 0001?

2. Should 0001 be combined with 0002 or kept separate?

3. Do you have a preference between this version of 0003 and the older
revision that just ignored outer-join relids?

--
Robert Haas
EDB: http://www.enterprisedb.com

Attachment Content-Type Size
v6-0002-Consider-a-Result-node-s-relids-in-ExplainPreScan.patch application/octet-stream 9.7 KB
v6-0001-Keep-track-of-what-RTIs-a-Result-node-is-scanning.patch application/octet-stream 70.1 KB
v6-0003-Ensure-that-all-joinrel-RTIs-are-discoverable-fro.patch application/octet-stream 17.1 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Nathan Bossart 2025-09-16 14:38:02 Re: Clarification on DROP OWNED BY command in PG18
Previous Message Bruce Momjian 2025-09-16 13:58:36 Re: PG 18 release notes draft committed