diff --git a/src/backend/commands/statscmds.c b/src/backend/commands/statscmds.c index 2f46180407a..d073d9b7c13 100644 --- a/src/backend/commands/statscmds.c +++ b/src/backend/commands/statscmds.c @@ -493,6 +493,8 @@ AlterStatistics(AlterStatsStmt *stmt) rel = table_open(StatisticExtRelationId, RowExclusiveLock); oldtup = SearchSysCache1(STATEXTOID, ObjectIdGetDatum(stxoid)); + if (!HeapTupleIsValid(oldtup)) + elog(ERROR, "cache lookup failed for extended statistics object %u", stxoid); /* Must be owner of the existing statistics object */ if (!pg_statistics_object_ownercheck(stxoid, GetUserId()))