]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Guard against table-AM-less relations in planner.
authorTom Lane <tgl@sss.pgh.pa.us>
Mon, 17 Oct 2022 15:35:23 +0000 (11:35 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Mon, 17 Oct 2022 15:35:23 +0000 (11:35 -0400)
commit62b263bf779ed5d1ad0ae3fb0a5790f773423beb
tree4c206ab50acecda3e93f0774a04c5c4e0bebd4c6
parentbc7a40b42eef717026d29b687157cd0af5adaadb
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
src/backend/optimizer/util/plancat.c