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

jian he <jian.universality@gmail.com>

From: jian he <jian.universality@gmail.com>
To: Álvaro Herrera <alvherre@kurilemu.de>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2025-05-08T04:59:02Z
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

Attachments

On Wed, May 7, 2025 at 10:56 PM Álvaro Herrera <alvherre@kurilemu.de> wrote:
>
> Ooh, you know what?  I ran your the CREATE DOMAIN statement in your new
> test and pg_dump'ed that, and as far as I can tell the _name_ of the
> not-null constraint is not dumped either.  So it's not just the comment
> that we're losing.  That's a separate bug, and probably needs to be
> fixed first, although I'm not sure if that one is going to be
> back-patchable.  Which means, I withdraw my earlier assessment that the
> comment fix is back-patchable as a whole.
>

for PG17. we change the dump of
create domain test.d4 as int constraint nn not null;
from
CREATE DOMAIN test.d4 AS integer NOT NULL;
to
CREATE DOMAIN test.d4 AS integer CONSTRAINT nn NOT NULL;

in PG17 we didn't preserve the constraint name, now if we did, then
it's a bug fix,
so it can be back-patchable?

Anyway, the attachment is for PG18 only now, it will fix the domain constraint
name loss and domain not-null comments loss issue together.