Re: persevere NO INHERIT when Dump not-null constraints on inherited columns

Álvaro Herrera <alvherre@kurilemu.de>

From: Álvaro Herrera <alvherre@kurilemu.de>
To: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
Cc: jian he <jian.universality@gmail.com>, PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2026-02-26T12:23:49Z
Lists: pgsql-hackers
On 2026-Feb-26, Ashutosh Bapat wrote:

> This could have been caught by 002_pg_upgrade's regression
> dump/restore test, if we had a NO INHERIT on child being tested in
> regression test and not dropped. I browsed through regression tests
> testing NO INHERIT. I found some adding NO INHERIT check constraint on
> child table but no NOT NULL constraint on child table. But I didn't
> look very closely. If that's true, we may not have enough coverage to
> check whether NO INHERIT on a child table is honoured or not when a
> grandchild is added. I did find a test which tests that NO INHERIT NOT
> NULL on the child table is not merged with normal NOT NULL constraint.

Hmm, yeah, feel free to propose a change so that those tables are not
dropped, so that this is exercised better in the
PG_TEST_EXTRA=regress_dump_restore case.  I guess the whole gamut of
NOT ENFORCED, NOT VALID etc ought to be covered that way.

-- 
Álvaro Herrera         PostgreSQL Developer  —  https://www.EnterpriseDB.com/



Commits

  1. pg_dump: Preserve NO INHERIT on NOT NULL on inheritance children

  2. Dump not-null constraints on inherited columns correctly