Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vqkpS-00HG4O-0l for pgsql-hackers@arkaria.postgresql.org; Fri, 13 Feb 2026 04:30:55 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vqkpR-00CTLn-0q for pgsql-hackers@arkaria.postgresql.org; Fri, 13 Feb 2026 04:30:54 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vqkpQ-00CTLe-38 for pgsql-hackers@lists.postgresql.org; Fri, 13 Feb 2026 04:30:53 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1vqkpM-00000000Qef-1SMK for pgsql-hackers@lists.postgresql.org; Fri, 13 Feb 2026 04:30:53 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 61D4Uhmd421634; Thu, 12 Feb 2026 23:30:43 -0500 From: Tom Lane To: Chao Li cc: Jim Jones , Fujii Masao , Matheus Alcantara , "pgsql-hackers@lists.postgresql.org" Subject: Re: COMMENTS are not being copied in CREATE TABLE LIKE In-reply-to: References: <50f693ad-faec-4b1b-8de5-88dc90b236b4@uni-muenster.de> Comments: In-reply-to Chao Li message dated "Fri, 13 Feb 2026 09:29:08 +0800" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <421632.1770957043.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Thu, 12 Feb 2026 23:30:43 -0500 Message-ID: <421633.1770957043@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Chao Li writes: > On Feb 12, 2026, at 23:33, Jim Jones wrote: >> On 12/02/2026 16:08, Fujii Masao wrote: >>> The documentation [1] states that INCLUDING COMMENTS copies comments f= or >>> the copied columns, constraints, and indexes. It does not mention copy= ing >>> comments on the table itself. Therefore, not copying table comments wi= th >>> 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=E2=80=99t look more closely= at the >> documentation :) Although I struggle to see the rationale for not >> copying a table=E2=80=99s 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. > I feel the current behavior is proper. When you create a table using > LIKE, you are cloning the structure, not the identity. Yeah, I was about to make a similar comment. We do not for example clone the ownership or permissions of the source table. Maybe there is an argument for cloning the table-level comment but it's by no means open-and-shut. So I think the current behavior is intentional not an oversight. Might be good to go find the thread in which the INCLUDING COMMENTS functionality was developed and see if there was discussion. (Speaking of which, I'm feeling very dubious about the nearby proposal to invent LIKE INCLUDING POLICIES. It's hard to credit that it makes sense to clone RLS policies while not cloning table ownership and permissions. But I suppose I should raise that point in that thread.) regards, tom lane