From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: When removing a relation from the query, drop its RelOptInfo.
Date: Mon, 13 Feb 2023 18:35:48 +0000
Message-ID: <E1pRdg3-000y7w-Ak@gemulon.postgresql.org> (raw)
When removing a relation from the query, drop its RelOptInfo.
In commit b78f6264e I opined that it was "too risky" to delete a
relation's RelOptInfo from the planner's data structures when we have
realized that we don't need to join to it; so instead we just marked
it as a dead relation. In hindsight that judgment seems flawed: any
subsequent access to such a dead relation is arguably a bug in
itself, so leaving the RelOptInfo present just helps to mask bugs.
Let's delete it instead, allowing removal of the whole notion of a
"dead relation". So far as the regression tests can find, this
requires no other code changes, except for one Assert in equivclass.c
that was very dubiously not complaining about access to a dead rel.
Discussion: https://postgr.es/m/229905.1676062220@sss.pgh.pa.us
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/e9a20e451f3aa0b64da807338012c65d8664d0ac
Modified Files
--------------
src/backend/optimizer/path/equivclass.c | 3 +--
src/backend/optimizer/plan/analyzejoins.c | 16 ++++++++++------
src/backend/optimizer/plan/initsplan.c | 8 ++++----
src/include/nodes/pathnodes.h | 6 +-----
4 files changed, 16 insertions(+), 17 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: When removing a relation from the query, drop its RelOptInfo.
In-Reply-To: <E1pRdg3-000y7w-Ak@gemulon.postgresql.org>
References: <E1pRdg3-000y7w-Ak@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