From 6beaa6c988dabc24c4af34cec9609ab95f3fd109 Mon Sep 17 00:00:00 2001
From: Greg Burd <greg@burd.me>
Date: Tue, 6 May 2025 11:19:29 -0400
Subject: [PATCH v1 3/3] Move ItemPointerSet() call to better match
 heap_page_prune_and_freeze().

Avoid unnecessary call in some cases and better align this slimmed down
version of the prune and freeze logic.

Author: Greg Burd <greg@burd.me>
---
 src/backend/access/heap/vacuumlazy.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/backend/access/heap/vacuumlazy.c b/src/backend/access/heap/vacuumlazy.c
index 14cf880340b..2c3bf86ca60 100644
--- a/src/backend/access/heap/vacuumlazy.c
+++ b/src/backend/access/heap/vacuumlazy.c
@@ -3649,8 +3649,6 @@ heap_page_is_all_visible(LVRelState *vacrel, Buffer buf,
 		if (!ItemIdIsUsed(itemid) || ItemIdIsRedirected(itemid))
 			continue;
 
-		ItemPointerSet(&(tuple.t_self), blockno, offnum);
-
 		/*
 		 * Dead line pointers can have index pointers pointing to them. So
 		 * they can't be treated as visible
@@ -3667,6 +3665,7 @@ heap_page_is_all_visible(LVRelState *vacrel, Buffer buf,
 		tuple.t_data = (HeapTupleHeader) PageGetItem(page, itemid);
 		tuple.t_len = ItemIdGetLength(itemid);
 		tuple.t_tableOid = RelationGetRelid(vacrel->rel);
+		ItemPointerSet(&(tuple.t_self), blockno, offnum);
 
 		switch (HeapTupleSatisfiesVacuum(&tuple, vacrel->cutoffs.OldestXmin,
 										 buf))
-- 
2.39.5 (Apple Git-154)

