pg_dump does not dump domain not-null constraint's comments - Mailing list pgsql-hackers

From jian he
Subject pg_dump does not dump domain not-null constraint's comments
Date
Msg-id CACJufxF-0bqVR=j4jonS6N2Ka6hHUpFyu3_3TWKNhOW_4yFSSg@mail.gmail.com
Whole thread Raw
Responses Re: pg_dump does not dump domain not-null constraint's comments
List pgsql-hackers
hi.

----------------------------------------------------
begin;
create schema test;
set search_path to test;
create domain d1 as int;
alter domain d1 add constraint nn not null;
alter domain d1 add constraint cc check (value is not null);
comment on constraint nn on domain d1 is 'not null constraint on domain d1';
comment on constraint cc on domain d1 is 'check constraint on domain d1';
commit;

------the above is the test script------------------
in PG17 and master, pg_dump (--schema=test --no-owner) will only produce
COMMENT ON CONSTRAINT cc ON DOMAIN test.d1 IS 'check constraint on domain d1';
but didn't produce
COMMENT ON CONSTRAINT nn ON DOMAIN test.d1 IS 'not null constraint on
domain d1';
we should make pg_dump to produce it too?

The attached patch tries to make it produce comments on not-null
constraints on domains.
I aslo renamed struct TypeInfo fields, nDomChecks will be renamed to
nDomConstrs;
domChecks will be renamed to domConstrs.

TypeInfo->domConstrs will also include not-null constraint
information, changing from
domChecks to domConstrs makes sense, IMHO.

Attachment

pgsql-hackers by date:

Previous
From: Andrei Lepikhov
Date:
Subject: Re: MergeAppend could consider sorting cheapest child path
Next
From: Alexander Pyhalov
Date:
Subject: Re: MergeAppend could consider sorting cheapest child path