diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2019-05-05 12:44:32 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2019-05-05 12:44:32 -0400 |
commit | 030ad0acfa5794c645a9a6093fdd3ed4d4f4788c (patch) | |
tree | b40acb93122a0461771f432e6fc8cb1c22dd3b38 | |
parent | 506af101f3e9d8f475e6a326eb0ad89f7db81eda (diff) | |
download | postgresql-030ad0acfa5794c645a9a6093fdd3ed4d4f4788c.tar.gz postgresql-030ad0acfa5794c645a9a6093fdd3ed4d4f4788c.zip |
Add check for syscache lookup failure in update_relispartition().
Omitted in commit 05b38c7e6 (though it looks like the original blame
belongs to 9e9befac4). A failure is admittedly unlikely, but if it
did happen, SIGSEGV is not the approved method of reporting it.
Per Coverity. Back-patch to v11 where the broken code originated.
-rw-r--r-- | src/backend/commands/indexcmds.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/backend/commands/indexcmds.c b/src/backend/commands/indexcmds.c index 9602fc5461c..726f9476550 100644 --- a/src/backend/commands/indexcmds.c +++ b/src/backend/commands/indexcmds.c @@ -2682,10 +2682,11 @@ update_relispartition(Oid relationId, bool newval) classRel = heap_open(RelationRelationId, RowExclusiveLock); tup = SearchSysCacheCopy1(RELOID, ObjectIdGetDatum(relationId)); + if (!HeapTupleIsValid(tup)) + elog(ERROR, "cache lookup failed for relation %u", relationId); Assert(((Form_pg_class) GETSTRUCT(tup))->relispartition != newval); ((Form_pg_class) GETSTRUCT(tup))->relispartition = newval; CatalogTupleUpdate(classRel, &tup->t_self, tup); heap_freetuple(tup); - heap_close(classRel, RowExclusiveLock); } |