Re: pg_dump misses comments on NOT NULL constraints

From: Álvaro Herrera <alvherre(at)kurilemu(dot)de>
To: Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>
Cc: jian he <jian(dot)universality(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: pg_dump misses comments on NOT NULL constraints
Date: 2025-06-25 15:45:06
Message-ID: 202506251545.ekt4u6lwncvu@alvherre.pgsql
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2025-Jun-26, Fujii Masao wrote:

> CREATE TABLE ctlt1_inh (LIKE ctlt1 INCLUDING CONSTRAINTS INCLUDING COMMENTS) INHERITS (ctlt1);
> \d+ ctlt1_inh
> -SELECT description FROM pg_description, pg_constraint c WHERE classoid = 'pg_constraint'::regclass AND objoid = c.oid AND c.conrelid = 'ctlt1_inh'::regclass;
> +SELECT conname, description FROM pg_description, pg_constraint c WHERE classoid = 'pg_constraint'::regclass AND objoid = c.oid AND c.conrelid = 'ctlt1_inh'::regclass ORDER BY conname COLLATE "C";
>
> However, since ctlt1_inh is created with INCLUDING COMMENTS, this test
> doesn't seem to demonstrate the case you mentioned — that comments on
> not-null constraints are copied even without INCLUDING CONSTRAINTS.
> Am I misunderstanding?

Hmm, yeah the case I wanted to modify was for ctlt12_comments which does
INCLUDING COMMENTS without constraints, apologies. In that case it's
better to modify ctlt2 instead, as shown here.

--
Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/

Attachment Content-Type Size
0001-test-fixup-v2.patch.txt text/plain 4.4 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ajit Awekar 2025-06-25 15:46:38 Unnecessary scan from non-overlapping range predicates
Previous Message jian he 2025-06-25 15:39:38 Re: pg_dump misses comments on NOT NULL constraints