Re: pgsql: Don't trust NOT NULL on virtual generated columns of partitioned

From: Álvaro Herrera <alvherre(at)kurilemu(dot)de>
To: shihao zhong <zhong950419(at)gmail(dot)com>
Cc: Richard Guo <guofenglinux(at)gmail(dot)com>, Richard Guo <rguo(at)postgresql(dot)org>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: pgsql: Don't trust NOT NULL on virtual generated columns of partitioned
Date: 2026-10-13 16:00:02
Message-ID: as5UaM2WWiFDiUAE@alvherre.pgsql
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

Hi,

On 2026-Oct-13, shihao zhong wrote:

> Álvaro Herrera <alvherre(at)kurilemu(dot)de> writes:
> > we read a NULL value from a column that's marked as not-null, which
> > shouldn't happen.
>
> One data point, this part is not new in 19. Your example reads the
> same NULL through the parent on 18.6.

Right -- I was running the reproducer in 18 as well.

> My initial idea is to just fix the PG19 regression instead of
> addressing the entire problem.

Yes, Richard committed this fix already -- I was replying to his commit
message of your fix.
https://postgr.es/m/flat/E1xFKs5-0000000116b-2Cge%40gemulon.postgresql.org

> > But I can see it breaks a lot of things, and what this commit does
> > is just to work-around one of the things that design breaks.
>
> Agree, I think there is a design question here and a more completed
> fix should target 20.

This is where I disagree ... IMO this is serious problem whose fix
should be back-patched. I suspect we don't really know what other
things this misfeature can break.

--
Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/
"Hay quien adquiere la mala costumbre de ser infeliz" (M. A. Evans)

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Álvaro Herrera 2026-10-13 16:00:17 Re: Fix WITHOUT OVERLAPS PKs used for functional grouping
Previous Message Álvaro Herrera 2026-10-13 15:45:13 Re: pgsql: Don't trust NOT NULL on virtual generated columns of partitioned

Browse pgsql-committers by date

  From Date Subject
Previous Message Álvaro Herrera 2026-10-13 15:45:13 Re: pgsql: Don't trust NOT NULL on virtual generated columns of partitioned