pgsql: Replace over-optimistic Assert in partitioning code with a runti

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Replace over-optimistic Assert in partitioning code with a runti
Date: 2017-06-04 20:21:02
Message-ID: E1dHc1G-00043z-90@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Replace over-optimistic Assert in partitioning code with a runtime test.

get_partition_parent felt that it could simply Assert that systable_getnext
found a tuple. This is unlike any other caller of that function, and it's
unsafe IMO --- in fact, the reason I noticed it was that the Assert failed.
(OK, I was working with known-inconsistent catalog contents, but I wasn't
expecting the DB to fall over quite that violently. The behavior in a
non-assert-enabled build wouldn't be very nice, either.) Fix it to do what
other callers do, namely an actual runtime-test-and-elog.

Also, standardize the wording of elog messages that are complaining about
unexpected failure of systable_getnext. 90% of them say "could not find
tuple for <object>", so make the remainder do likewise. Many of the
holdouts were using the phrasing "cache lookup failed", which is outright
misleading since no catcache search is involved.

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/e7941a976688f0f5d13a5227ed4f3efe0718db9d

Modified Files
--------------
contrib/sepgsql/database.c | 2 +-
contrib/sepgsql/proc.c | 4 ++--
contrib/sepgsql/relation.c | 8 ++++----
contrib/sepgsql/schema.c | 2 +-
src/backend/catalog/aclchk.c | 4 ++--
src/backend/catalog/objectaddress.c | 2 +-
src/backend/catalog/partition.c | 3 ++-
src/backend/commands/extension.c | 9 +++++----
src/backend/utils/adt/ruleutils.c | 2 +-
9 files changed, 19 insertions(+), 17 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Heikki Linnakangas 2017-06-05 08:31:27 pgsql: Fix comments in simplehash.h.
Previous Message Tom Lane 2017-06-04 17:34:15 pgsql: #ifdef out assorted unused GEQO code.