Skip to content

Commit 62148c3

Browse files
committed
Add check for syscache lookup failure in update_relispartition().
Omitted in commit 05b38c7 (though it looks like the original blame belongs to 9e9befa). 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.
1 parent 84e4570 commit 62148c3

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/backend/commands/indexcmds.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3451,10 +3451,11 @@ update_relispartition(Oid relationId, bool newval)
34513451

34523452
classRel = table_open(RelationRelationId, RowExclusiveLock);
34533453
tup = SearchSysCacheCopy1(RELOID, ObjectIdGetDatum(relationId));
3454+
if (!HeapTupleIsValid(tup))
3455+
elog(ERROR, "cache lookup failed for relation %u", relationId);
34543456
Assert(((Form_pg_class) GETSTRUCT(tup))->relispartition != newval);
34553457
((Form_pg_class) GETSTRUCT(tup))->relispartition = newval;
34563458
CatalogTupleUpdate(classRel, &tup->t_self, tup);
34573459
heap_freetuple(tup);
3458-
34593460
table_close(classRel, RowExclusiveLock);
34603461
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy