On Fri, Oct 9, 2026 at 12:42 PM shihao zhong <zhong950419(at)gmail(dot)com> wrote:
>
> Hi hackers,
>
> I used Opus to analyze the new features in PG19, and it found three
> bugs with a CHECK constraint that a child enforces and its parent
> does not. Each item has a script and a patch with its number.
> "Before" is 19 and master today. "After" is with the patch, and is
> the output I expect.
>
> 3. pg_dump prints only the parent's definition, so the child is NOT
> ENFORCED after a restore. pg_upgrade is fine.
>
> create table p3 (a int, constraint c check (a > 0) not enforced);
> create table k3 () inherits (p3);
> alter table k3 alter constraint c enforced;
> Before, pg_dump -s has:
> ALTER TABLE public.p3
> ADD CONSTRAINT c CHECK ((a > 0)) NOT ENFORCED;
> After 0003, it also has:
> ALTER TABLE public.k3 ALTER CONSTRAINT c ENFORCED;
Hi.
Let pg_dump produce ALTER CONSTRAINT seems weird.
We can let pg_dump produce inline constraint (within CREATE TABLE
statement) or ALTER TABLE ADD CONSTRAINT, see the attached.
--
jian
https://www.enterprisedb.com/