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

From: shihao zhong <zhong950419(at)gmail(dot)com>
To: Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org, Manu <manuelreyesbravo(at)gmail(dot)com>, Álvaro Herrera <alvherre(at)kurilemu(dot)de>, Richard Guo <guofenglinux(at)gmail(dot)com>
Subject: Re: pgsql: Don't trust NOT NULL on virtual generated columns of partitioned
Date: 2026-11-17 01:43:57
Message-ID: CAGRkXqSL2fnh-EWSHQ878+LdpG8z9Y8+YQ1UkSG_vftr1BSvzQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

Hi Zsolt,

Thanks for your review, I appreciate it.

> With this restriction master can't create divergent partitions
> anymore, and pg_upgrade refuses them, so is d8444163d still needed on
> master after this patch?

19 still needs it. A 19 cluster may already have such partitions,
and a minor update does not run pg_upgrade.

> 1. Explicit vs implicit cast

v5 compares the deparsed text, which is what pg_dump writes.

> 2. ONLY with a detach-pending partition

The recursive SET EXPRESSION skipped those partitions too.
ONLY now counts them as children. Without ONLY, the command asks to
finish the detach first.

> ddl.sgml, a few lines below the paragraph
fixed.

> Plain inheritance has the same wrong results, both on master and with
> the patch:

v5 applies the same rule to plain inheritance, so your cc example now
fails at CREATE TABLE. pg_upgrade refuses such children too.

I also found CREATE TABLE ... (LIKE ...) INHERITS skips these checks.
I think it needs to have its own thread.

Thanks,
Shihao

Attachment Content-Type Size
nocfbot-v5-REL_18-0001-Require-child-tables-to-use-the-parent-s-virtual-gen.patch application/octet-stream 38.5 KB
v5-0001-Require-child-tables-to-use-the-parent-s-virtual-gen.patch application/octet-stream 45.1 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message shihao zhong 2026-11-17 01:45:34 CREATE TABLE LIKE with INHERITS skips checks on generated columns
Previous Message Jonah Shafran 2026-11-17 01:39:26 Re: ISBN range table

Browse pgsql-committers by date

  From Date Subject
Previous Message Tom Lane 2026-11-16 20:04:09 pgsql: Stamp 19.0.