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 1vqXo2-00Coiv-0x for pgsql-hackers@arkaria.postgresql.org; Thu, 12 Feb 2026 14:36:35 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vqXo1-008mug-1H for pgsql-hackers@arkaria.postgresql.org; Thu, 12 Feb 2026 14:36:34 +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 1vqXo1-008muX-0M for pgsql-hackers@lists.postgresql.org; Thu, 12 Feb 2026 14:36:33 +0000 Received: from mail-yw1-x112f.google.com ([2607:f8b0:4864:20::112f]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1vqXnz-00000000KMY-35AW for pgsql-hackers@lists.postgresql.org; Thu, 12 Feb 2026 14:36:33 +0000 Received: by mail-yw1-x112f.google.com with SMTP id 00721157ae682-7961e04355cso68751077b3.3 for ; Thu, 12 Feb 2026 06:36:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1770906990; x=1771511790; darn=lists.postgresql.org; h=in-reply-to:references:to:from:subject:cc:message-id:date :content-transfer-encoding:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=5S5RzB1cf9Z1zAcpqvoAHnMvntKniaF9D0NvWT2A9Zg=; b=biiusEv7cqEcfcShQ+JKo4zQ8UX+SFHaoiGdbNgEwyOKUPexp6jTRxcLXRhrFHeGFN DExvUUZr7b+x9/kw4ObNXn0rwtADEtXxDTn2mqOPtSoSa7PD4d1+BiEz8Vc4RWzn+Y5z MWaCGyLvzqx+9WW1GzfGdzyjZC74jhy/wUlpj59+THPbqQsdua0LZ7BQILvRfz4XePHH lDRhFhNMaZTy9Ao+8v2/3vtUGuO9WgAK5bQJkzvRCaUQi4wo/xTlzczGU5DW7n903xYt 4pHJxdWRAQNpQEJOxZ8KNKd49a//EP98atZQpTEA4TkrR43cSK6HS9pnVq4dCmUWjVsx ZB+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770906990; x=1771511790; h=in-reply-to:references:to:from:subject:cc:message-id:date :content-transfer-encoding:mime-version:x-gm-gg:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=5S5RzB1cf9Z1zAcpqvoAHnMvntKniaF9D0NvWT2A9Zg=; b=DFM5Pw6mz8+wa412he7kfO0FPU5NgeN3uJnAOmetdAlBLDneYdGrBVOPNgUBdKd//5 f98Z2mpx883lWzxp3qdu20Q9+LCwR5PulnpZRAfBjmy8WLG62uNKDlnoyTWW6ZBgIeWW Dm9v2iZMrXlfT8qQkwm64hYYACvZhRxTfkRvcdcRd47pO21+ll+WfrYYf4i4G7nTZ5hy UORzGcDz6u+6gKb8S50pLmtkolVuyXB9GDazK+L9tSCzDCTh5qb3DEVnMJw87yE5PCCs p1UQFArJAOiSMrHX29ILpFh7UBWekwEI2NRuSeFte8RTSVgL8v6ekfVeHpqCRMMfNThO 2Kag== X-Forwarded-Encrypted: i=1; AJvYcCU71swFflAALyZvWX4Rj81JODm71Iq3NiQLc+BWBIDTkuhOvBSLf7FSlUtGxPqABiC6a1/wdX9N379Ff6kf@lists.postgresql.org X-Gm-Message-State: AOJu0YzvKE/sYct/yLFZoSyQIjxJjbSLmGKGIg7vo64cxlmR8+vPJFxe 9WWmxzSsBy0FzF/DfLOqbGBPQFyZXQyUKN5nUH6YnxocN/hIYE46xzUI X-Gm-Gg: AZuq6aIMNTvV9DlsS+LScINqN9eiFrvcqf9KoHQhKGq+ccufaoCcYKgTaYbP2sJehzO mSZuo+UVkj0OhndHLhPEYt2uh8EndI7up3jeN1//1MABXHVc2hU9kVoMU7LUFpa3rYyneYrvtS+ TN7rknGDXLjVrWixXcmVjhR9DZDQG7ricsDLHJA5wvBgJrmdYXdIjWLRkPN/ScFR7W3ftfPj2jO rp3nUHwWHE+KbuYqX++7UQk98VM+dzNl+zs3WbxCTJ1j4FvjxSAPxEQsZQ0vOkheIexMZJhhRZ0 rfbyXB+EJGX/j1QAirfi8rrqyB0zcasAllQyQ9ISng8F6iB7TVViqRDr0NVKvxT+K1e0TIRNko7 OD+o+eGtlmcAJ6jvPqRkysHqrUqMdq/JiEYgCDuL1e2/1BB2bFssQj5dTJiH2uHDaEDVOqLFaCv KbbnivynLv4MeXVLYtlGzRp88X3h0kwag8QFhrQMBpu9pTkQ== X-Received: by 2002:a05:690c:e34d:b0:794:fcf8:f824 with SMTP id 00721157ae682-797376df999mr28442467b3.28.1770906990050; Thu, 12 Feb 2026 06:36:30 -0800 (PST) Received: from localhost ([2804:14d:328a:a59c:2551:f0bd:33c7:95d2]) by smtp.gmail.com with ESMTPSA id 00721157ae682-7966c18b464sm47442427b3.13.2026.02.12.06.36.28 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 12 Feb 2026 06:36:29 -0800 (PST) Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Thu, 12 Feb 2026 11:36:26 -0300 Message-Id: Cc: "Matheus Alcantara" Subject: Re: COMMENTS are not being copied in CREATE TABLE LIKE From: "Matheus Alcantara" To: "Jim Jones" , "pgsql-hackers@lists.postgresql.org" X-Mailer: aerc 0.21.0 References: In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, thanks for checking this. On Thu Feb 12, 2026 at 7:11 AM -03, Jim Jones wrote: > Hi, > > While reviewing another patch[1] I saw that COMMENTS on tables are being > ignored in CREATE TABLE LIKE: > > psql (18.1 (Debian 18.1-1.pgdg13+2)) > Type "help" for help. > > postgres=3D# \pset null '(null)' > Null display is "(null)". > postgres=3D# CREATE TABLE t1 (id int, name text); > COMMENT ON TABLE t1 IS 'table comment'; > CREATE TABLE t2 (LIKE t1 INCLUDING ALL); > CREATE TABLE t3 (LIKE t1 INCLUDING COMMENTS); > > SELECT > obj_description('t1'::regclass, 'pg_class') AS t1_comment, > obj_description('t2'::regclass, 'pg_class') AS t2_comment, > obj_description('t3'::regclass, 'pg_class') AS t3_comment; > CREATE TABLE > COMMENT > CREATE TABLE > CREATE TABLE > t1_comment | t2_comment | t3_comment > ---------------+------------+------------ > table comment | (null) | (null) > (1 row) > > > v1 attached attempts to fix it by expanding expandTableLikeClause() to > retrieve and copy the table-level comment when the INCLUDING COMMENTS > [ALL] option is specified: > The patch fix the issue and it seems correct to me. This bug seems to also happen on 14.20: postgres=3D# select version(); version ---------------------------------------------------------------------------= --------------------------------------------------- PostgreSQL 14.20 (Homebrew) on aarch64-apple-darwin24.6.0, compiled by App= le clang version 17.0.0 (clang-1700.4.4.1), 64-bit (1 row) postgres=3D# CREATE TABLE t(a int, b text); CREATE TABLE postgres=3D# COMMENT ON TABLE t IS 'foo'; COMMENT postgres=3D# CREATE TABLE t2(LIKE t INCLUDING ALL); CREATE TABLE postgres=3D# SELECT obj_description('t'::regclass, 'pg_class') as t_comment= , obj_description('t2'::regclass, 'pg_class') AS t2_comment; t_comment | t2_comment -----------+------------ foo | (1 row) So I think that we need to backport. -- Matheus Alcantara EDB: https://www.enterprisedb.com