Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 030ad0a

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 506af10 commit 030ad0a

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
@@ -2682,10 +2682,11 @@ update_relispartition(Oid relationId, bool newval)
26822682

26832683
classRel = heap_open(RelationRelationId, RowExclusiveLock);
26842684
tup = SearchSysCacheCopy1(RELOID, ObjectIdGetDatum(relationId));
2685+
if (!HeapTupleIsValid(tup))
2686+
elog(ERROR, "cache lookup failed for relation %u", relationId);
26852687
Assert(((Form_pg_class) GETSTRUCT(tup))->relispartition != newval);
26862688
((Form_pg_class) GETSTRUCT(tup))->relispartition = newval;
26872689
CatalogTupleUpdate(classRel, &tup->t_self, tup);
26882690
heap_freetuple(tup);
2689-
26902691
heap_close(classRel, RowExclusiveLock);
26912692
}

0 commit comments

Comments
 (0)