diff --git a/src/backend/commands/dbcommands.c b/src/backend/commands/dbcommands.c index 5fbbcdaabb..9ec07e52e0 100644 --- a/src/backend/commands/dbcommands.c +++ b/src/backend/commands/dbcommands.c @@ -337,6 +337,10 @@ ScanSourceDatabasePgClassPage(Page page, Buffer buf, Oid tbid, Oid dbid, maxoff = PageGetMaxOffsetNumber(page); + /* block and tableOid is the same for all tuples, set it once outside the loop */ + ItemPointerSetBlockNumber(&tuple.t_self, blkno); + tuple.t_tableOid = RelationRelationId; + /* Loop over offsets. */ for (offnum = FirstOffsetNumber; offnum <= maxoff; @@ -352,12 +356,11 @@ ScanSourceDatabasePgClassPage(Page page, Buffer buf, Oid tbid, Oid dbid, continue; Assert(ItemIdIsNormal(itemid)); - ItemPointerSet(&(tuple.t_self), blkno, offnum); /* Initialize a HeapTupleData structure. */ tuple.t_data = (HeapTupleHeader) PageGetItem(page, itemid); tuple.t_len = ItemIdGetLength(itemid); - tuple.t_tableOid = RelationRelationId; + ItemPointerSetOffsetNumber(&tuple.t_self, offnum); /* Skip tuples that are not visible to this snapshot. */ if (HeapTupleSatisfiesVisibility(&tuple, snapshot, buf))