Re: BUG #19858: pg_dump --clean --if-exists fails on NOT VALID domain constraint

From: shihao zhong <zhong950419(at)gmail(dot)com>
To: Dilip Kumar <dilipbalaut(at)gmail(dot)com>
Cc: 125atishprak(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #19858: pg_dump --clean --if-exists fails on NOT VALID domain constraint
Date: 2026-11-21 17:30:36
Message-ID: CAGRkXqT2im=k3htagnEUPMv_Qw4HxZDuTP6SrDW8tv5ZTOShdg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi Dilip,

Thanks for the example, looks like this problem is not that simple.

In v2 the foreign table fix comes first, since it is the one to
back-patch. The code is unchanged. It applies to 16 through 19 as is,
and I attached a version for 15.

0002 lets the existing DROP CONSTRAINT IF EXISTS skip a missing domain
with a notice. We did the same for DROP TRIGGER IF EXISTS on a missing
table in b152c6cd0de, also for pg_dump --clean. It changes behavior,
so I think it is for master only.

The other way is to add ALTER DOMAIN IF EXISTS. I preferred 0002
because dump scripts from older pg_dump versions then work too and
easy to implement.

Let me know what you think.

Thanks,
Shihao

Attachment Content-Type Size
v2-0001-Fix-pg_dump-clean-if-exists-for-foreign-table-constr.patch application/octet-stream 4.0 KB
v2-0002-Don-t-fail-ALTER-DOMAIN-DROP-CONSTRAINT-IF-EXISTS-on.patch application/octet-stream 6.0 KB
nocfbot-v2-REL_15-0001-Fix-pg_dump-clean-if-exists-for-foreign-table-constr.patch application/octet-stream 4.0 KB

In response to

Browse pgsql-bugs by date

  From Date Subject
Previous Message Fujii Masao 2026-11-21 14:00:02 Re: BUG #19881: CLUSTER uses a disabled sort path when enable_sort is off