On Thu, Dec 05, 2024 at 08:46:45AM -0800, James Hunter wrote: > On Wed, Dec 4, 2024 at 10:13 PM Michael Paquier <mich...@paquier.xyz> wrote: > > > > totalpages is signed, and BlockNumber is unsigned. Hence in theory > > you could always fall into a trap once totalpages gets higher than > > (2^31 - 1), no? This is not going to be a problem in practice even if > > the number of pages per range assigned to brin can be 1, still.. > > Good point -- so the fix should be something like: (a) make totalpages > a BlockNumber or uint32; (b) cast either "totalpages" or "10" to > int64, before returning the result?
Sure, you could do (a) and (b) together. It also seems to me that it is just simpler to make totalpages a int64 to map automatically with the result expected by the caller of bringetbitmap(), and we know that based on MaxBlockNumber we'll never run out of bits. -- Michael
signature.asc
Description: PGP signature