pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Álvaro Herrera <alvherre@kurilemu.de>
To: Richard Guo <guofenglinux@gmail.com>
Cc: pgsql-hackers@lists.postgresql.org
Subject: Re: pgsql: Don't trust NOT NULL on virtual generated columns of partitioned
Date: Tue, 13 Oct 2026 17:45:13 +0200
Message-ID: <as5LS1intVNRgPRR@alvherre.pgsql> (raw)
In-Reply-To: <CAMbWs49_5+iScJWmG8zNqVLM45pn3KHZDbbkvc3jUSjNc_Jipw@mail.gmail.com>

On 2026-Oct-13, Richard Guo wrote:

> On Tue, Oct 13, 2026 at 9:43 PM Álvaro Herrera <alvherre@kurilemu.de> wrote:
> > I find this very surprising.  Are we sure that it makes sense for a
> > partition to have a generating expression that differs from the one in
> > the parent table?
> 
> No, I don't think it makes sense for a partition to have a different
> virtual generation expression than its parent.  I raised this exact
> same complaint in [1], the paragraph starting with "Regarding #4",
> quoted below:
> 
>   Regarding #4, the fix is to not trust NOT NULL on a virtual generated
>   column of a partitioned table.  But I don't like this fix at all.  I
>   think the real problem is that a partition is allowed to have a
>   different virtual generation expression than its parent.

It looks like we reached the same conclusion.  I propose we restrict
this.  Ideally we'd do that at least starting with 19.  (I would in fact
go even further and say that we should add restrictions to all affected
stable branches, and provide SQL scripts that users can run to find and
remove those that already exist there.)  I don't have a patch though,
but I imagine it should be easy.

-- 
Álvaro Herrera               48°01'N 7°57'E  —  https://www.EnterpriseDB.com/
"Hay quien adquiere la mala costumbre de ser infeliz" (M. A. Evans)





view thread (24+ messages)  latest in thread

Message-ID: <as5LS1intVNRgPRR@alvherre.pgsql>
Permalink:  ../as5LS1intVNRgPRR@alvherre.pgsql/
Also on:    postgresql.org/message-id/as5LS1intVNRgPRR@alvherre.pgsql

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: alvherre@kurilemu.de, guofenglinux@gmail.com, pgsql-hackers@lists.postgresql.org
  Subject: Re: pgsql: Don't trust NOT NULL on virtual generated columns of partitioned
  In-Reply-To: <as5LS1intVNRgPRR@alvherre.pgsql>
  References: <CAMbWs49_5+iScJWmG8zNqVLM45pn3KHZDbbkvc3jUSjNc_Jipw@mail.gmail.com> <as5LS1intVNRgPRR@alvherre.pgsql>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox