Re: PG17beta2: SMGR: inconsistent type for nblocks - Mailing list pgsql-hackers

From Thomas Munro
Subject Re: PG17beta2: SMGR: inconsistent type for nblocks
Date
Msg-id CA+hUKGLbk53zCgXs2dgFA9GhS2NnDSMW5ikBLuBk7VRGd=FYJg@mail.gmail.com
Whole thread Raw
Responses Re: PG17beta2: SMGR: inconsistent type for nblocks
List pgsql-hackers
On Tue, Jul 30, 2024 at 11:24 PM Matthias van de Meent
<boekewurm@gmail.com> wrote:
> While working on rebasing the patches of Neon's fork onto the
> REL_17_STABLE branch, I noticed that the nblocks arguments of various
> smgr functions have inconsistent types: smgrzeroextend accepts
> `nblocks` as signed integer, as does the new signature for
> smgrprefetch, but the new vectorized operations of *readv and *writev,
> and the older *writeback all use an unsigned BlockNumber as indicator
> for number of blocks.
>
> Can we update the definition to be consistent across this (new, or
> also older) API? As far as I can see, in none of these cases are
> negative numbers allowed or expected, so updating this all to be
> consistently BlockNumber across the API seems like a straigthforward
> patch.
>
> cc-ed Thomas as committer of the PG17 smgr API changes.

Hi Matthias,

Yeah, right, I noticed that once myself[1].  For the cases from my
keyboard, I guess I was trying to be consistent with nearby existing
stuff in each case, which was already inconsistent...  Do you have a
patch?

[1] https://www.postgresql.org/message-id/CA%2BhUKGLx5bLwezZKAYB2O_qHj%3Dov10RpgRVY7e8TSJVE74oVjg%40mail.gmail.com



pgsql-hackers by date:

Previous
From: David Rowley
Date:
Subject: Re: Add mention of execution time memory for enable_partitionwise_* GUCs
Next
From: Tomas Vondra
Date:
Subject: Re: WIP: parallel GiST index builds