diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c index 462b1a9636..e29efa1023 100644 --- a/src/backend/utils/cache/relcache.c +++ b/src/backend/utils/cache/relcache.c @@ -313,7 +313,7 @@ ScanPgRelation(Oid targetRelId, bool indexOK, bool force_non_historic) Relation pg_class_desc; SysScanDesc pg_class_scan; ScanKeyData key[1]; - Snapshot snapshot; + Snapshot snapshot = NULL; /* * If something goes wrong during backend startup, we might find ourselves @@ -343,12 +343,12 @@ ScanPgRelation(Oid targetRelId, bool indexOK, bool force_non_historic) /* * The caller might need a tuple that's newer than the one the historic * snapshot; currently the only case requiring to do so is looking up the - * relfilenode of non mapped system relations during decoding. + * relfilenode of non mapped system relations during decoding. That + * snapshot cant't change in the midst of a relcache build, so there's no + * need to register the snapshot. */ if (force_non_historic) snapshot = GetNonHistoricCatalogSnapshot(RelationRelationId); - else - snapshot = GetCatalogSnapshot(RelationRelationId); pg_class_scan = systable_beginscan(pg_class_desc, ClassOidIndexId, indexOK && criticalRelcachesBuilt,