Re: COMMENTS are not being copied in CREATE TABLE LIKE - Mailing list pgsql-hackers

From Chao Li
Subject Re: COMMENTS are not being copied in CREATE TABLE LIKE
Date
Msg-id A5D95968-7484-461B-AA32-273C9161E9B2@gmail.com
Whole thread Raw
In response to Re: COMMENTS are not being copied in CREATE TABLE LIKE  (Jim Jones <jim.jones@uni-muenster.de>)
Responses Re: COMMENTS are not being copied in CREATE TABLE LIKE
List pgsql-hackers

> On Feb 12, 2026, at 23:33, Jim Jones <jim.jones@uni-muenster.de> wrote:
>
>
>
> On 12/02/2026 16:08, Fujii Masao wrote:
>> On Thu, Feb 12, 2026 at 11:36 PM Matheus Alcantara
>> <matheusssilv97@gmail.com> wrote:
>>> The patch fix the issue and it seems correct to me.
>
> Thanks for the review!
>
>> The documentation [1] states that INCLUDING COMMENTS copies comments for
>> the copied columns, constraints, and indexes. It does not mention copying
>> comments on the table itself. Therefore, not copying table comments with
>> INCLUDING COMMENTS does not appear to be a bug. That is, the proposed patch
>> seems more like an improvement than a bug fix.
>
> Hmm, it seemed so obvious to me that I didn’t look more closely at the
> documentation :) Although I struggle to see the rationale for not
> copying a table’s comment in a CREATE TABLE LIKE ... INCLUDING COMMENTS
> statement, I have to agree that the documentation is quite clear about
> this limitation, and therefore it cannot really be considered a bug.
> That said, it may well be worth considering for a future release.
>
> What are your thoughts?
>
> Thanks!
>
> Best, Jim
>
>

I feel the current behavior is proper. When you create a table using LIKE, you are cloning the structure, not the
identity.Just as you have to pick a new name for the table, you should provide a new comment that fits its specific
purpose.If a comment is needed, the COMMENT ON command is already the straightforward way to handle that. 

Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/







pgsql-hackers by date:

Previous
From: Henson Choi
Date:
Subject: Re: Row pattern recognition
Next
From: "Hayato Kuroda (Fujitsu)"
Date:
Subject: RE: BUG: Former primary node might stuck when started as a standby