Re: COMMENTS are not being copied in CREATE TABLE LIKE

From: Jim Jones <jim(dot)jones(at)uni-muenster(dot)de>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
Cc: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, Matheus Alcantara <matheusssilv97(at)gmail(dot)com>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>, "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Subject: Re: COMMENTS are not being copied in CREATE TABLE LIKE
Date: 2026-02-26 13:39:02
Message-ID: ceccea29-b7a9-4b79-9a06-6e1197d7f290@uni-muenster.de
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 13/02/2026 10:19, Jim Jones wrote:
> ...
> Example:
>
> CREATE TABLE t1 (a int);
> COMMENT ON TABLE t1 IS 'comment from table 1';
> CREATE TABLE t2 (b int);
> COMMENT ON TABLE t2 IS 'comment from table 2';
> CREATE TABLE t3 (c int);
> COMMENT ON TABLE t3 IS 'comment from table 3';
>
> CREATE TABLE tm (
> LIKE t1 INCLUDING COMMENTS,
> LIKE t3 INCLUDING COMMENTS,
> LIKE t2 INCLUDING COMMENTS
> );
>
> SELECT obj_description('tm'::regclass, 'pg_class') AS table_comment;
> table_comment
> ----------------------
> comment from table 1+
> comment from table 3+
> comment from table 2
> (1 row)
>
>
> Any thoughts on that?

Rebase

Best, Jim

Attachment Content-Type Size
v3-0001-Add-table-comments-in-CREATE-TABLE-LIKE-INCLUDING.patch text/x-patch 9.6 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Henson Choi 2026-02-26 13:46:01 Re: Row pattern recognition
Previous Message Henson Choi 2026-02-26 13:34:03 Re: Row pattern recognition