From: | Álvaro Herrera <alvherre(at)kurilemu(dot)de> |
---|---|
To: | jian he <jian(dot)universality(at)gmail(dot)com> |
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-07-15 13:40:38 |
Message-ID: | 202507151340.d4jyrbdae5af@alvherre.pgsql |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 2025-Jul-15, jian he wrote:
> On Tue, Jul 15, 2025 at 2:10 PM jian he <jian(dot)universality(at)gmail(dot)com> wrote:
> > accidently found another existing bug.
> > CREATE SCHEMA test;
> > CREATE DOMAIN test.d1 AS integer NOT NULL DEFAULT 11;
> > COMMENT ON CONSTRAINT a2 ON DOMAIN test.d1 IS 'test';
> > ALTER DOMAIN test.d1
> > ADD CONSTRAINT a2 CHECK ((VALUE > 1)) NOT VALID;
> >
> > Obviously the COMMENT command will error out.
> > currently working on a fix, just sharing the bug details in advance.
Ouch, ugh. I think this is as old as NOT VALID constraints on domains,
maybe from commit 897795240cfa (Jun 2011), or ... no, actually
7eca575d1c28 (Dec 2014) which enabled constraints on domains to have
comments. In either case it's my fault, and the fix needs to be
backpatched all the way back, so I'm going to apply this bugfix one
ahead of the others, which are for newer bugs.
> we should let:
> dumpConstraint handles dumping separate "NOT VALID" domain constraints along
> with their comments.
> dumpDomain: handles dumping "inlined" valid (not separate) domain constraints
> together with their comments.
Yeah, this makes sense.
> tested locally, i didn't write the test on src/bin/pg_dump/t/002_pg_dump.pl....
I'll add something for coverage, but not yet sure if it's going to be
something in 002_pg_dump.pl, or objects to be left around for the
pg_upgrade test to pick up.
--
Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/
Attachment | Content-Type | Size |
---|---|---|
0001-Fix-dumping-of-comments-on-invalid-constraints-on-do.patch | text/x-diff | 2.3 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Vitale, Anthony, Sony Music | 2025-07-15 13:58:17 | Question on any plans to use the Create Server/Create blink_ Mapping to provide Logical Replication Subscriptions the user/password in an encrypted manner |
Previous Message | Andres Freund | 2025-07-15 12:42:12 | Re: Improving and extending int128.h to more of numeric.c |