Re: pgsql: Revert online data checksum transitions - Mailing list pgsql-hackers

From Bryan Green
Subject Re: pgsql: Revert online data checksum transitions
Date
Msg-id CAF+pBj_bSQ3tZ28wZCUq1Pnm0+9_gpVOxp_fAKZMFmuvB2cggw@mail.gmail.com
Whole thread
In response to Re: pgsql: Revert online data checksum transitions  (Jacob Champion <jacob.champion@enterprisedb.com>)
Responses Re: pgsql: Revert online data checksum transitions
List pgsql-hackers
If we are pulling in stdbool.h and this is C11...that is undefined behavior and because it wasn't validly initialized it is an indeterminate-value read...which means for optimization that the compiler is within its right to assume it is a 0 or 1 and could test it in different ways depending on the surrounding code (nonzero test, compare to 1, etc).  

On Wed, Sep 16, 2026 at 12:34 PM Jacob Champion <jacob.champion@enterprisedb.com> wrote:
On Wed, Sep 16, 2026 at 10:14 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
> However, what I'm seeing as I trace through the crash on
> longfin is that nulls[19] has a value that's not either 0 or 1 (not
> too surprising), and somehow heap_compute_data_size is interpreting
> that as "true" while fill_val is reading it as "false".  According
> to my understanding of the C standard, fill_val is in the wrong here.

Is the _Bool representation allowed to contain anything but zero/false
or one/true? I thought that was undefined behavior. (IIRC, mixing C++
bool with our C89-era bool definition suffered from similar UB
excitement.)

--Jacob


pgsql-hackers by date:

Previous
From: Jacob Champion
Date:
Subject: Re: pgsql: Revert online data checksum transitions
Next
From: Alvaro Herrera
Date:
Subject: Re: Routed ON CONFLICT inserts broken by partition-local deferrable unique constraints in 19 and master