Re: pg_dump does not dump domain not-null constraint's comments

Álvaro Herrera <alvherre@kurilemu.de>

From: Álvaro Herrera <alvherre@kurilemu.de>
To: Noah Misch <noah@leadboat.com>
Cc: jian he <jian.universality@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2025-09-13T11:59:29Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Fix pg_dump COMMENT dependency for separate domain constraints.

  2. pg_dump: include comments on not-null constraints on domains, too

  3. Fix dumping of comments on invalid constraints on domains

  4. Catalog domain not-null constraints

  5. In pg_dump, don't dump a stats object unless dumping underlying table.

  6. Enable CHECK constraints to be declared NOT VALID

On 2025-Sep-12, Noah Misch wrote:

> The last argument gives the dump object on which the comment has a dependency.
> Since this is the case of a separately-dumped constraint, the comment needs to
> depend on that constraint (coninfo), not on the domain (tyinfo):
> 
> -							coninfo->dobj.catId, 0, tyinfo->dobj.dumpId);
> +							coninfo->dobj.catId, 0, coninfo->dobj.dumpId);
> 
> I didn't encounter a failure from this, but sufficient restore parallelism
> might reach a failure.  A failure would look like a "does not exist" error in
> the COMMENT command, due to the constraint not yet existing.
> dumpTableConstraintComment() is an older case that optimally handles the last
> dumpComment() arg.

Sounds sane.

> In the absence of objections, I'll make it so.

Please do, thanks.

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