[PATCH v1] remove redundant check of item pointer

From: Junwang Zhao <zhjwpku(at)gmail(dot)com>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: [PATCH v1] remove redundant check of item pointer
Date: 2022-04-27 12:04:00
Message-ID: 20220427120400.65649-1-zhjwpku@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)gmail(dot)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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message vignesh C 2022-04-27 12:50:11 Re: Skipping schema changes in publication
Previous Message Amit Kapila 2022-04-27 11:48:46 Re: bogus: logical replication rows/cols combinations