diff --git a/src/backend/commands/indexcmds.c b/src/backend/commands/indexcmds.c index 9602fc5461..726f947655 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); }