Re: Mis-use of type BlockNumber? - Mailing list pgsql-hackers

From Melanie Plageman
Subject Re: Mis-use of type BlockNumber?
Date
Msg-id CAAKRu_a1WELioFMLy2UvDnbwa67Srayfb-QhhvxyABb9fW3ivw@mail.gmail.com
Whole thread
In response to Re: Mis-use of type BlockNumber?  (Chao Li <li.evan.chao@gmail.com>)
Responses Re: Mis-use of type BlockNumber?
List pgsql-hackers
On Fri, Mar 6, 2026 at 9:11 AM Chao Li <li.evan.chao@gmail.com> wrote:
>
> But I think we should avoid to introduce such usages in new code. In other words, while reviewing patches, we should
raisecomments for such mis-usages. Is my understanding correct? 

I also don't like how BlockNumber is used this way. However, if you
introduce a new counter and use uint32 instead when all surrounding
counters are BlockNumber, it sticks out as different and is confusing.
If you go and change all instances of BlockNumber being used this way
because you added one new counter, that's a lot of churn. If we decide
to change BlockNumber to a struct, we'll have a good reason and be
willing to pay the price of the churn at that point. I'm not a
stickler for consistency and in fact think it's okay to have some
things inconsistent if it means introducing new patterns that are
better. But having a single counter in a struct of the same unit as a
bunch of existing counters be a different datatype doesn't seem worth
it to me.

- Melanie



pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Allow specifying NULL default in pg_proc.dat for "any" arguments
Next
From: Álvaro Herrera
Date:
Subject: Re: Rework SLRU I/O errors handle