Re: BUG #19928: pg_upgrade fails on v18 schema with NOT NULL ... NO INHERIT and inheritance

From: Raja Sai pranav <rajasaipranav0(at)gmail(dot)com>
To: exclusion(at)gmail(dot)com
Cc: alvherre(at)kurilemu(dot)de, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #19928: pg_upgrade fails on v18 schema with NOT NULL ... NO INHERIT and inheritance
Date: 2026-11-26 09:59:29
Message-ID: CAPHduZBHkcODSh5EkbXXKSre2Fwcw0LNM+mG4ftOmiQNH6eQYw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On 26/11/2026 07:00, Alexander Lakhin wrote:
> Would you like to look also at a close one?:
> [...]
> ALTER TABLE notnull_tbl1 ADD CONSTRAINT nn NOT NULL a NOT VALID; -- ok
> CREATE TABLE notnull_tbl1_child2 (c int, b int, a int);
> ALTER TABLE notnull_tbl1_child2 ADD NOT NULL a NOT VALID;
> ALTER TABLE notnull_tbl1_child2 INHERIT notnull_tbl1;

Yes, thanks. I reproduced it: a master pg_dump of this schema from 18.7
fails to restore into master with the same error. It doesn't need
pg_upgrade or an older server, though: creating the schema on master
and doing a plain pg_dump / psql restore into another master database
fails the same way.

pg_dump emits both NOT VALID constraints as separate ALTER TABLE ... ADD
CONSTRAINT commands after the data, parent first. Adding "nn" to the
parent recurses and gives the child an inherited constraint named "nn",
so the child's own command then fails the name check added by 96e2af605.

I'll look into a fix, unless Álvaro would rather handle it.

Regards,
Sai Pranav

Browse pgsql-bugs by date

  From Date Subject
Next Message Raja Sai pranav 2026-11-26 10:11:49 btree_gist: <-> fails on same-sign infinite intervals
Previous Message Raja Sai pranav 2026-11-26 09:53:31 Re: BUG #19928: pg_upgrade fails on v18 schema with NOT NULL ... NO INHERIT and inheritance