Fix pg_dump for inherited validated not-null constraints
authorÁlvaro Herrera <alvherre@kurilemu.de>
Mon, 28 Apr 2025 14:25:06 +0000 (16:25 +0200)
committerÁlvaro Herrera <alvherre@kurilemu.de>
Mon, 28 Apr 2025 14:25:06 +0000 (16:25 +0200)
commit0e13b13d26e870cb18fe6ecf9f8697ddfcf2c740
treeac9ccb0c9611817be9fcec2e34d57e6ea830e01b
parentc061000311029d2ef0129ad5eee32e698221d43d
Fix pg_dump for inherited validated not-null constraints

When a child constraint is validated and the parent constraint it
derives from isn't, pg_dump must be coerced into printing the child
constraint; failing to do would result in a dump that restores the
constraint as not valid, which would be incorrect.

Co-authored-by: jian he <jian.universality@gmail.com>
Co-authored-by: Álvaro Herrera <alvherre@kurilemu.de>
Reported-by: jian he <jian.universality@gmail.com>
Message-id: https://postgr.es/m/CACJufxGHNNMc0E2JphUqJMzD3=bwRSuAEVBF5ekgkG8uY0Q3hg@mail.gmail.com
src/bin/pg_dump/common.c
src/bin/pg_dump/pg_dump.c
src/bin/pg_dump/pg_dump.h
src/bin/pg_dump/t/002_pg_dump.pl
src/test/regress/expected/constraints.out
src/test/regress/sql/constraints.sql