From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix missed step in removal of useless RESULT RTEs in the planner
Date: Sat, 05 Dec 2020 21:16:33 +0000
Message-ID: <E1kleuv-0002Ac-J4@gemulon.postgresql.org> (raw)
Fix missed step in removal of useless RESULT RTEs in the planner.
Commit 4be058fe9 forgot that the append_rel_list would already be
populated at the time we remove useless result RTEs, and it might contain
PlaceHolderVars that need to be adjusted like the ones in the main parse
tree. This could lead to "no relation entry for relid N" failures later
on, when the planner tries to do something with an unadjusted PHV.
Per report from Tom Ellis. Back-patch to v12 where the bug came in.
Discussion: https://postgr.es/m/20201205173056.GF30712@cloudinit-builder
Branch
------
REL_13_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/7d43b76f6ed97b3b27f30114636f7b116009ef61
Modified Files
--------------
src/backend/optimizer/prep/prepjointree.c | 1 +
src/test/regress/expected/join.out | 36 +++++++++++++++++++++++++++++++
src/test/regress/sql/join.sql | 22 +++++++++++++++++++
3 files changed, 59 insertions(+)
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: Fix missed step in removal of useless RESULT RTEs in the planner
In-Reply-To: <E1kleuv-0002Ac-J4@gemulon.postgresql.org>
References: <E1kleuv-0002Ac-J4@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