pgsql: When removing a relation from the query, drop its RelOptInfo. - Mailing list pgsql-committers

From Tom Lane
Subject pgsql: When removing a relation from the query, drop its RelOptInfo.
Date
Msg-id E1pRdg3-000y7w-Ak@gemulon.postgresql.org
Whole thread Raw
List 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(-)


pgsql-committers by date:

Previous
From: Tom Lane
Date:
Subject: pgsql: Fix buggy recursion in flatten_rtes_walker().
Next
From: Jeff Davis
Date:
Subject: pgsql: Correct docs for the default locale_provider of a new database.