Subject: pgsql: doc: Clarify INCLUDING COMMENTS behavior in CREATE TABLE LIKE.

From: Fujii Masao <[email-masked]>
Date: Thu, 26 Feb 2026 00:04:41 +0000

doc: Clarify INCLUDING COMMENTS behavior in CREATE TABLE LIKE.

The documentation for the INCLUDING COMMENTS option of the LIKE clause
in CREATE TABLE was inaccurate and incomplete. It stated that comments for
copied columns, constraints, and indexes are copied, but regarding comments
on constraints in reality only comments on CHECK and NOT NULL constraints
are copied; comments on other constraints (such as primary keys) are not.
In addition, comments on extended statistics are copied, but this was not
documented.

The CREATE FOREIGN TABLE documentation had a similar omission: comments
on extended statistics are also copied, but this was not mentioned.

This commit updates the documentation to clarify the actual behavior.
The CREATE TABLE reference now specifies that comments on copied columns,
CHECK constraints, NOT NULL constraints, indexes, and extended statistics are
copied. The CREATE FOREIGN TABLE reference now notes that comments on
extended statistics are copied as well.

Backpatch to all supported versions. Documentation updates related to
CREATE FOREIGN TABLE LIKE and NOT NULL constraint comment copying are
not applied to v17 and earlier, since those features were introduced in v18.

Author: Fujii Masao <[email-masked]>
Reviewed-by: Matheus Alcantara <[email-masked]>
Discussion: https://postgr.es/m/[email-masked]
Backpatch-through: 14

Branch
------
REL_16_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/fe99a0338953fdcba5ba1aaaa2330435fd44d709

Modified Files
--------------
doc/src/sgml/ref/create_table.sgml | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)