From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Refactor addition of PlaceHolderVars to joinrel targetlists.
Date: Wed, 17 Aug 2022 20:12:46 +0000
Message-ID: <E1oOPPA-0000Zx-UJ@gemulon.postgresql.org> (raw)
Refactor addition of PlaceHolderVars to joinrel targetlists.
Make build_joinrel_tlist() responsible for adding PHVs that were
already computed in one or the other input relation, and therefore
change add_placeholders_to_joinrel() to only add PHVs that will be
newly computed in this joinrel's output. This makes the handling
of PHVs in build_joinrel_tlist() more like its handling of plain
Vars, which seems like a good thing on intelligibility grounds
and will simplify planned future changes. There is a purely
cosmetic side-effect that the order of entries in the joinrel's
tlist may change; but since it becomes more like the order of
entries in the input tlists, that's not bad.
The reason it wasn't done like this originally was the potential
cost of looking up PlaceHolderInfo entries to consult ph_needed.
Now that that's O(1) it shouldn't hurt.
Discussion: https://postgr.es/m/1405792.1660677844@sss.pgh.pa.us
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/afa0ec30bfd18611ec5bc4dfa394dc8838aece21
Modified Files
--------------
src/backend/optimizer/util/placeholder.c | 28 +++++++++++++++-------------
src/backend/optimizer/util/relnode.c | 23 +++++++++++++++++++----
src/test/regress/expected/join.out | 4 ++--
3 files changed, 36 insertions(+), 19 deletions(-)
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: tgl@sss.pgh.pa.us
Subject: Re: pgsql: Refactor addition of PlaceHolderVars to joinrel targetlists.
In-Reply-To: <E1oOPPA-0000Zx-UJ@gemulon.postgresql.org>
References: <E1oOPPA-0000Zx-UJ@gemulon.postgresql.org>
* 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