Re: Signed vs. Unsigned (some)

From: Justin Pryzby <pryzby(at)telsasoft(dot)com>
To: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
Cc: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>, ranier(dot)vf(at)gmail(dot)com, pgsql-hackers(at)postgresql(dot)org, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Subject: Re: Signed vs. Unsigned (some)
Date: 2021-07-02 14:58:50
Message-ID: 20210702145850.GU21248@telsasoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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 <tgl(at)sss(dot)pgh(dot)pa(dot)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 <alvherre(at)alvh(dot)no-ip(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2021-07-02 14:58:56 Re: Detecting File Damage & Inconsistencies
Previous Message Robert Haas 2021-07-02 14:46:30 Re: [bug?] Missed parallel safety checks, and wrong parallel safety