public inbox for [email protected]
help / color / mirror / Atom feedFrom: Peter Eisentraut <[email protected]>
To: Michael Paquier <[email protected]>
To: Kirill Reshke <[email protected]>
Cc: li carol <[email protected]>
Cc: Roman Khapov <[email protected]>
Cc: pgsql-hackers <[email protected]>
Cc: zengman <[email protected]>
Subject: Re: Use correct macro for accessing offset numbers.
Date: Fri, 24 Apr 2026 10:23:23 +0200
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <CALdSSPidtC7j3MwhkqRj0K2hyp36ztnnjSt6qzGxQtiePR1dzw@mail.gmail.com>
<[email protected]>
<CALdSSPgzLF8Vx7S0HpJo4rR3tc6Wqnr68JZ9LMOoVGPZSM0dTA@mail.gmail.com>
<[email protected]>
<TYSPR01MB6650128F7CCEBE1C809AE51E8181A@TYSPR01MB6650.apcprd01.prod.exchangelabs.com>
<CALdSSPgVwxxT5_kXpQktmiYfir=gPuYzaiiEpJadqN91VshHHA@mail.gmail.com>
<[email protected]>
On 14.01.26 09:08, Michael Paquier wrote:
> On Mon, Jan 12, 2026 at 01:51:10PM +0500, Kirill Reshke wrote:
>> PFA v3 with fixes for signed usage across the tree, with my new
>> findings and suggestions from thread
>
> Note that the change in get_opfamily_member() is not right based on
> the type of "strategy". The rest was OK, so done.
The thread [0] is proposing a patch to change these things in the
opposite direction, effectively reverting commit 6dcfac9696c.
I think the premise of the patch in this thread is incorrect. You have
changed
Int16GetDatum(offset)
to
UInt16GetDatum(offset)
because the variable offset is of type OffsetNumber, which is uint16.
But that is not the meaning of the "UInt16" in UInt16GetDatum(), at
least that's the argument being made in the other thread.
These values end up being converted to an output parameter of type
smallint, and the output function int2out uses DatumGetInt16() to
convert its argument. So the *GetDatum() function should match that, so
we should use Int16GetDatum().
The real problem here is that offset values that are uint32 are being
output via the SQL type smallint, which can't handle the whole set of
values, but this is probably not a problem in practice.
[0]:
https://www.postgresql.org/message-id/flat/CALdSSPhFyb9qLSHee73XtZm1CBWJNo9+JzFNf-zUEWCRW5yEiQ@mail....
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], [email protected], [email protected]
Subject: Re: Use correct macro for accessing offset numbers.
In-Reply-To: <[email protected]>
* 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