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-22 07:08:46
Message-ID: CACJufxEzGhfmBVeLGzOALZYwrje2aZT9RZeq0ZsmUEh3TLb3CQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

hi.

"Catalog domain not-null constraints" commit[1]
doesn't have a pg_dump test.

I actually found another bug.
create schema test;
CREATE DOMAIN test.d1 AS integer NOT NULL default 11;
pg_dump --schema=test > 1.sql
""
pg_dump: warning: could not resolve dependency loop among these items:
pg_dump: detail: TYPE d1 (ID 1415 OID 18007)
pg_dump: detail: CONSTRAINT d1_not_null (ID 1416 OID 18008)
""

Catalog domain not-null constraints is committed in 17, so no need to
worry about before 17 branches.

The attached patch will work for PG17 and PG18.

You can use the following SQL examples
to compare with master and see the intended effect of my attached patch.

CREATE DOMAIN test.d1 AS integer NOT NULL default 11;
CREATE DOMAIN test.d3 AS integer constraint nn NOT NULL default 11;

[1] https://git.postgresql.org/cgit/postgresql.git/commit/?id=e5da0fe3c22b34c4433f1729e88495554b5331ed

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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniil Davydov 2025-05-22 07:43:57 Re: POC: Parallel processing of indexes in autovacuum
Previous Message Richard Guo 2025-05-22 07:05:55 Pathify RHS unique-ification for semijoin planning