Re: CREATE TABLE LIKE(INCLUDING COMMENTS) description ignored STATISTICS

From: jian he <jian(dot)universality(at)gmail(dot)com>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: "pgsql-docs(at)lists(dot)postgresql(dot)org" <pgsql-docs(at)lists(dot)postgresql(dot)org>
Subject: Re: CREATE TABLE LIKE(INCLUDING COMMENTS) description ignored STATISTICS
Date: 2025-09-18 09:03:10
Message-ID: CACJufxHmS+S8=4ikGW3_85TLgD_v+WXvabSXP8QGGdD+rRWNZg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-docs

On Sun, Sep 7, 2025 at 1:03 PM David G. Johnston
<david(dot)g(dot)johnston(at)gmail(dot)com> wrote:
>
> On Saturday, September 6, 2025, jian he <jian(dot)universality(at)gmail(dot)com> wrote:
>>
>> hi.
>>
>> https://www.postgresql.org/docs/devel/sql-createtable.html#SQL-CREATETABLE-PARMS-LIKE-OPT-COMMENTS
>> """
>> INCLUDING COMMENTS
>> Comments for the copied columns, constraints, and indexes will be copied. The
>> default behavior is to exclude comments, resulting in the copied columns and
>> constraints in the new table having no comments.
>> """
>>
>> The above description should mention that comments on extended
>> statistics will be
>> copied as well?
>>
>
> How about “If specified, existing comments on any copied elements are copied as well.” ? Let’s fix this by removing the duplication of the list of things allowed to be copied, not by fixing the oversight the duplication permitted.
>

“If specified, existing comments on any copied elements are copied as well.”
some properties/elements don't have comments.

currently doc:
-------------------------------------------------
The optional like_option clauses specify which additional properties
of the original table to copy. Specifying INCLUDING copies the
property, specifying EXCLUDING omits the property. EXCLUDING is the
default. If multiple specifications are made for the same kind of
object, the last one is used. The available options are:

INCLUDING COMMENTS
Comments for the copied columns, constraints, and indexes will be
copied. The default behavior is to exclude comments, resulting in the
copied columns and constraints in the new table having no comments.

------------------------------------------------------------------------
The second sentence is redundant, because we already mentioned:
"EXCLUDING is the default".
So I am ok with:
"Comments for the copied columns, constraints, extended statistics and
indexes will be copied".
the second sentence "The default behavior is to exclude comments...."
can be removed.

I also found that
https://www.postgresql.org/docs/devel/sql-createforeigntable.html
has the same problem.

In response to

Browse pgsql-docs by date

  From Date Subject
Next Message PG Doc comments form 2025-09-23 07:09:42 Confusion in section 8.7.3. Type Safety
Previous Message PG Doc comments form 2025-09-18 02:26:00 Important topic is missed: comparing composite types