public inbox for [email protected]
help / color / mirror / Atom feedFrom: li carol <[email protected]>
To: Michael Paquier <[email protected]>
To: Kirill Reshke <[email protected]>
Cc: Roman Khapov <[email protected]>
Cc: pgsql-hackers <[email protected]>
Subject: RE: Use correct macro for accessing offset numbers.
Date: Mon, 12 Jan 2026 05:36:15 +0000
Message-ID: <TYSPR01MB6650128F7CCEBE1C809AE51E8181A@TYSPR01MB6650.apcprd01.prod.exchangelabs.com> (raw)
In-Reply-To: <[email protected]>
References: <CALdSSPidtC7j3MwhkqRj0K2hyp36ztnnjSt6qzGxQtiePR1dzw@mail.gmail.com>
<[email protected]>
<CALdSSPgzLF8Vx7S0HpJo4rR3tc6Wqnr68JZ9LMOoVGPZSM0dTA@mail.gmail.com>
<[email protected]>
>
> On Sun, Jan 11, 2026 at 04:58:39PM +0500, Kirill Reshke wrote:
> > Maybe, I have stopped some more cases, in v2-0001
>
> Right. It's true that we could be more consistent for all these based on their
> base type, some of them, particularly in the GIN code now, caring about using
> the correct macro. It may be a good occasion to double-check the whole tree
> for similar holes based on unsigned types.
> --
> Michael
Hi Kirill, Roman, and Michael,
While double-checking the tree for similar holes as Michael suggested, I noticed a couple more inconsistencies in contrib/pageinspect/ginfuncs.c where we are using signed macros for unsigned types.
Specifically, in gin_page_opaque_info, we use Int32GetDatum for maxoff:
values[1] = Int32GetDatum(opaq->maxoff);
Since maxoff is of type OffsetNumber (uint16), this seems to be the exact same pattern Kirill is addressing in other parts of the GIN code. Although it is widened to int32 here, for the sake of consistency, it should probably be using a 16-bit or unsigned macro.
Similarly, in gin_metapage_info, tailFreeSize (which is defined as uint32 in GinMetaPageData) is also converted using Int32GetDatum:
values[2] = Int32GetDatum(metadata->tailFreeSize);
It might be better to include these cleanups in the next version of the patch to ensure all pageinspect GIN functions follow the same standard.
Best regards,
Yuan Li(carol)
view thread (5+ messages) latest in thread
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], [email protected], [email protected], [email protected]
Subject: RE: Use correct macro for accessing offset numbers.
In-Reply-To: <TYSPR01MB6650128F7CCEBE1C809AE51E8181A@TYSPR01MB6650.apcprd01.prod.exchangelabs.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