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

From Andres Freund
Subject Re: Mis-use of type BlockNumber?
Date
Msg-id j4iku72lpbidvksioykfjiqsrehezzqfr25s6v7xvulsmfrclj@3h5qw5ct5zsb
Whole thread
In response to Re: Mis-use of type BlockNumber?  (Melanie Plageman <melanieplageman@gmail.com>)
Responses Re: Mis-use of type BlockNumber?
List pgsql-hackers
Hi,

On 2026-03-06 10:22:10 -0500, Melanie Plageman wrote:
> 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
shouldraise comments 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.

FWIW, I don't think uint32 would be a good choice. I think we're eventually
going to have to allow larger relations and a lot of counters in uint32 would
make that a good bit harder than right now, where it's BlockNumber.  So you'd
have to introduce a new BlockCounter type. At which point you ... can just use
BlockNumber, or uint64 (and waste space for now).

Greetings,

Andres Freund



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: Reduce timing overhead of EXPLAIN ANALYZE using rdtsc?
Next
From: Masahiko Sawada
Date:
Subject: Re: Trivial Fix: use palloc_array/repalloc_array for BufFile file arrays