Re: pgsql: Revert online data checksum transitions

From: Bryan Green <dbryan(dot)green(at)gmail(dot)com>
To: Jacob Champion <jacob(dot)champion(at)enterprisedb(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Daniel Gustafsson <daniel(at)yesql(dot)se>, Masao Fujii <masao(dot)fujii(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: pgsql: Revert online data checksum transitions
Date: 2026-09-16 17:44:32
Message-ID: CAF+pBj84ziPgjCyUK9apHVnAa1gz0BPqDnLakNi8JvLUk2ducg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

This is the goto example:
https://markshroyer.com/2012/06/c-both-true-and-false/

On Wed, Sep 16, 2026 at 12:39 PM Bryan Green <dbryan(dot)green(at)gmail(dot)com> wrote:

> 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(dot)champion(at)enterprisedb(dot)com> wrote:
>
>> On Wed, Sep 16, 2026 at 10:14 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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
>>
>>
>>

In response to

Browse pgsql-committers by date

  From Date Subject
Next Message Robert Haas 2026-09-16 18:57:43 pgsql: pg_plan_advice: Disallow empty sublists within JOIN_ORDER()
Previous Message Bryan Green 2026-09-16 17:39:27 Re: pgsql: Revert online data checksum transitions

Browse pgsql-hackers by date

  From Date Subject
Next Message Bharath Rupireddy 2026-09-16 17:48:35 Re: Support for 8-byte TOAST values, round two
Previous Message Alvaro Herrera 2026-09-16 17:39:39 Re: Routed ON CONFLICT inserts broken by partition-local deferrable unique constraints in 19 and master