Обсуждение: pgsql: Refactor addition of PlaceHolderVars to joinrel targetlists.

Поиск
Список
Период
Сортировка

pgsql: Refactor addition of PlaceHolderVars to joinrel targetlists.

От
Tom Lane
Дата:
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(-)