[PATCH v1] remove redundant check of item pointer - Mailing list pgsql-hackers

From Junwang Zhao
Subject [PATCH v1] remove redundant check of item pointer
Date
Msg-id 20220427120400.65649-1-zhjwpku@gmail.com
Whole thread Raw
Responses Re: [PATCH v1] remove redundant check of item pointer
List pgsql-hackers
In function ItemPointerEquals, the ItemPointerGetBlockNumber
already checked the ItemPointer if valid, there is no need
to check it again in ItemPointerGetOffset, so use
ItemPointerGetOffsetNumberNoCheck instead.

Signed-off-by: Junwang Zhao <zhjwpku@gmail.com>
---
 src/backend/storage/page/itemptr.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/backend/storage/page/itemptr.c b/src/backend/storage/page/itemptr.c
index 9011337aa8..61ad727b1d 100644
--- a/src/backend/storage/page/itemptr.c
+++ b/src/backend/storage/page/itemptr.c
@@ -37,8 +37,8 @@ ItemPointerEquals(ItemPointer pointer1, ItemPointer pointer2)
 
     if (ItemPointerGetBlockNumber(pointer1) ==
         ItemPointerGetBlockNumber(pointer2) &&
-        ItemPointerGetOffsetNumber(pointer1) ==
-        ItemPointerGetOffsetNumber(pointer2))
+        ItemPointerGetOffsetNumberNoCheck(pointer1) ==
+        ItemPointerGetOffsetNumberNoCheck(pointer2))
         return true;
     else
         return false;
-- 
2.33.0




pgsql-hackers by date:

Previous
From: Amit Kapila
Date:
Subject: Re: bogus: logical replication rows/cols combinations
Next
From: vignesh C
Date:
Subject: Re: Skipping schema changes in publication