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

From: jian he <jian(dot)universality(at)gmail(dot)com>
To: Álvaro Herrera <alvherre(at)kurilemu(dot)de>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: pg_dump does not dump domain not-null constraint's comments
Date: 2025-05-08 04:59:02
Message-ID: CACJufxEM5HMqfDDv7brOj3TA89LQremzrTs+hxKKSBWrMDHCEw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, May 7, 2025 at 10:56 PM Álvaro Herrera <alvherre(at)kurilemu(dot)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.

Attachment Content-Type Size
v3-0002-sanitize-variable-or-argument-name-in-pg_dump.patch text/x-patch 4.0 KB
v3-0001-Improve-pg_dump-handling-of-domain-not-null-constraints.patch text/x-patch 8.2 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2025-05-08 05:22:00 Re: queryId constant squashing does not support prepared statements
Previous Message Nathan Bossart 2025-05-08 03:51:49 Re: regdatabase