From: | Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com> |
---|---|
To: | Álvaro Herrera <alvherre(at)kurilemu(dot)de> |
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:04:28 |
Message-ID: | 6260d8fa-6339-4c62-abd0-57a5e400cc65@oss.nttdata.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 2025/06/25 20:46, Álvaro Herrera wrote:
> On 2025-Jun-25, Fujii Masao wrote:
>
>> From 516e647e7d1fdafc64dba092389963f32cd688e5 Mon Sep 17 00:00:00 2001
>> From: Fujii Masao <fujii(at)postgresql(dot)org>
>> Date: Wed, 25 Jun 2025 10:02:56 +0900
>> Subject: [PATCH v2] Make CREATE TABLE LIKE copy comments on NOT NULL
>> constraints when requested.
>>
>> Commit 14e87ffa5c5 introduced support for adding comments to NOT NULL
>> constraints. However, CREATE TABLE LIKE INCLUDING COMMENTS did not copy
>> these comments to the new table. This was an oversight in that commit.
>>
>> This commit corrects the behavior by ensuring CREATE TABLE LIKE to also copy
>> the comments on NOT NULL constraints when INCLUDING COMMENTS is specified.
>
> LGTM. I'd add a line in the test showing that these comments are copied
> even if INCLUDING CONSTRAINTS is not given,
+1 to adding that test.
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?
Regards,
--
Fujii Masao
NTT DATA Japan Corporation
From | Date | Subject | |
---|---|---|---|
Next Message | Greg Sabino Mullane | 2025-06-25 15:17:54 | Re: display hot standby state in psql prompt |
Previous Message | Nathan Bossart | 2025-06-25 15:04:19 | Re: Remove HeapTupleheaderSetXmin{Committed,Invalid} functions |