pgsql: When removing a relation from the query, drop its RelOptInfo.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: When removing a relation from the query, drop its RelOptInfo.
Date: 2023-02-13 18:35:48
Message-ID: E1pRdg3-000y7w-Ak@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Jeff Davis 2023-02-14 01:27:04 pgsql: Correct docs for the default locale_provider of a new database.
Previous Message Tom Lane 2023-02-13 17:20:02 pgsql: Fix buggy recursion in flatten_rtes_walker().