pgsql: Guard against table-AM-less relations in planner. - Mailing list pgsql-committers

From Tom Lane
Subject pgsql: Guard against table-AM-less relations in planner.
Date
Msg-id E1okS9T-002mdT-Ju@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Guard against table-AM-less relations in planner.

The executor will dump core if it's asked to execute a seqscan on
a relation having no table AM, such as a view.  While that shouldn't
really happen, it's possible to get there via catalog corruption,
such as a missing ON SELECT rule.  It seems worth installing a defense
against that.  There are multiple plausible places for such a defense,
but I picked the planner's get_relation_info().

Per discussion of bug #17646 from Kui Liu.  Back-patch to v12 where
the tableam APIs were introduced; in older versions you won't get a
SIGSEGV, so it seems less pressing.

Discussion: https://postgr.es/m/17646-70c93cfa40365776@postgresql.org

Branch
------
REL_15_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/2e3326929b0ba9f421f2ab1270c57b294c208a99

Modified Files
--------------
src/backend/optimizer/util/plancat.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)


pgsql-committers by date:

Previous
From: Michael Paquier
Date:
Subject: pgsql: Fix calculation related to temporary WAL segment name in basic_a
Next
From: Tom Lane
Date:
Subject: pgsql: Reject non-ON-SELECT rules that are named "_RETURN".