On Fri, Jul 02, 2021 at 12:09:23PM +0200, Peter Eisentraut wrote: > On 16.06.21 10:48, Peter Eisentraut wrote: > > On 15.06.21 10:17, Kyotaro Horiguchi wrote: > > > The definitions are not ((type) -1) but ((type) 0xFFFFFFFF) so > > > actually they might be different if we forget to widen the constant > > > when widening the types. Regarding to the compiler behavior, I think > > > we are assuming C99[1] and C99 defines that -1 is converted to > > > Uxxx_MAX. (6.3.1.3 Singed and unsigned integers) > > > > > > I'm +0.2 on it. It might be worthwhile as a matter of style. > > > > I think since we have the constants we should use them. > > I have pushed the InvalidBucket changes. > > The use of InvalidBlockNumber with vac_update_relstats() looks a bit fishy > to me. We are using in the same call 0 as the default for > num_all_visible_pages, and we generally elsewhere also use 0 as the starting > value for relpages, so it's not clear to me why it should be -1 or > InvalidBlockNumber here. I'd rather leave it "slightly wrong" for now so it > can be checked again.
There's two relevant changes: |commit 3d351d916b20534f973eda760cde17d96545d4c4 |Author: Tom Lane <t...@sss.pgh.pa.us> |Date: Sun Aug 30 12:21:51 2020 -0400 | | Redefine pg_class.reltuples to be -1 before the first VACUUM or ANALYZE. |commit 0e69f705cc1a3df273b38c9883fb5765991e04fe |Author: Alvaro Herrera <alvhe...@alvh.no-ip.org> |Date: Fri Apr 9 11:29:08 2021 -0400 | | Set pg_class.reltuples for partitioned tables 3d35 also affects partitioned tables, and 0e69 appears to do the right thing by preserving relpages=-1 during auto-analyze. Note that Alvaro's commit message and comment refer to relpages, but should have said reltuples - comment fixed at 7ef8b52cf. -- Justin