public inbox for [email protected]
help / color / mirror / Atom feedFrom: Kirill Reshke <[email protected]>
To: pgsql-hackers <[email protected]>
Subject: Use correct macro for accessing offset numbers.
Date: Sun, 11 Jan 2026 16:21:43 +0500
Message-ID: <CALdSSPidtC7j3MwhkqRj0K2hyp36ztnnjSt6qzGxQtiePR1dzw@mail.gmail.com> (raw)
Hi hackers!
While working on pageinspect support for GIN and SpGiST (welcome to
review them [0] & [1]), I spotted $subi.
PFA trivial patch that uses UInt16GetDatum for OffsetNumber rather
than Int16GetDatum
[0]https://www.postgresql.org/message-id/CALdSSPiN13n7feQcY0WCmq8jzxjwqhNrt1E%3Dg%3Dg6aZANyE_OoQ%40mail...
[1] https://www.postgresql.org/message-id/CALdSSPhbAQbFtjK0nT8_G5GsXmsSEVx8J735Ga%2BZxLp9osHcRA%40mail.g...
--
Best regards,
Kirill Reshke
Attachments:
[application/octet-stream] v1-0001-Use-correct-macro-for-accessing-offset-numbers.patch (1.7K, 2-v1-0001-Use-correct-macro-for-accessing-offset-numbers.patch)
download | inline diff:
From 803a8aac4656c320362cad6c55508320983b3c57 Mon Sep 17 00:00:00 2001
From: reshke <[email protected]>
Date: Sun, 11 Jan 2026 11:17:13 +0000
Subject: [PATCH v1] Use correct macro for accessing offset numbers.
---
contrib/pageinspect/btreefuncs.c | 2 +-
contrib/pageinspect/gistfuncs.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/contrib/pageinspect/btreefuncs.c b/contrib/pageinspect/btreefuncs.c
index 62c905c6e7c..0585b7cee40 100644
--- a/contrib/pageinspect/btreefuncs.c
+++ b/contrib/pageinspect/btreefuncs.c
@@ -507,7 +507,7 @@ bt_page_print_tuples(ua_page_items *uargs)
j = 0;
memset(nulls, 0, sizeof(nulls));
- values[j++] = Int16GetDatum(offset);
+ values[j++] = UInt16GetDatum(offset);
values[j++] = ItemPointerGetDatum(&itup->t_tid);
values[j++] = Int32GetDatum((int) IndexTupleSize(itup));
values[j++] = BoolGetDatum(IndexTupleHasNulls(itup));
diff --git a/contrib/pageinspect/gistfuncs.c b/contrib/pageinspect/gistfuncs.c
index 60a4b240302..9b7e3cec882 100644
--- a/contrib/pageinspect/gistfuncs.c
+++ b/contrib/pageinspect/gistfuncs.c
@@ -175,7 +175,7 @@ gist_page_items_bytea(PG_FUNCTION_ARGS)
memset(nulls, 0, sizeof(nulls));
- values[0] = Int16GetDatum(offset);
+ values[0] = UInt16GetDatum(offset);
values[1] = ItemPointerGetDatum(&itup->t_tid);
values[2] = Int32GetDatum((int) IndexTupleSize(itup));
@@ -282,7 +282,7 @@ gist_page_items(PG_FUNCTION_ARGS)
memset(nulls, 0, sizeof(nulls));
- values[0] = Int16GetDatum(offset);
+ values[0] = UInt16GetDatum(offset);
values[1] = ItemPointerGetDatum(&itup->t_tid);
values[2] = Int32GetDatum((int) IndexTupleSize(itup));
values[3] = BoolGetDatum(ItemIdIsDead(id));
--
2.43.0
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected]
Subject: Re: Use correct macro for accessing offset numbers.
In-Reply-To: <CALdSSPidtC7j3MwhkqRj0K2hyp36ztnnjSt6qzGxQtiePR1dzw@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox