You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
doc: Reorganize CREATE TABLE / LIKE option documentation
This section once started out small but has now grown quite a bit and
needs a bit of structure.
Rewrite as list, add documentation of EXCLUDING, and improve the
documentation of INCLUDING ALL instead of just listing all the options
again.
per report from Yugo Nagata that EXCLUDING was not documented, that part
reviewed by Daniel Gustafsson, most of the rewrite was by me
and <literal>EXCLUDE</literal> constraints on the original table will be
602
-
created on the new table only if <literal>INCLUDING INDEXES</literal>
603
-
is specified. Names for the new indexes and constraints are
604
-
chosen according to the default rules, regardless of how the originals
605
-
were named. (This behavior avoids possible duplicate-name failures for
606
-
the new indexes.)
607
-
</para>
608
-
<para>
609
-
<literal>STORAGE</literal> settings for the copied column definitions will be
610
-
copied only if <literal>INCLUDING STORAGE</literal> is specified. The
611
-
default behavior is to exclude <literal>STORAGE</literal> settings, resulting
612
-
in the copied columns in the new table having type-specific default
613
-
settings. For more on <literal>STORAGE</literal> settings, see
614
-
<xref linkend="storage-toast"/>.
615
-
</para>
616
-
<para>
617
-
Comments for the copied columns, constraints, and indexes
618
-
will be copied only if <literal>INCLUDING COMMENTS</literal>
619
-
is specified. The default behavior is to exclude comments, resulting in
620
-
the copied columns and constraints in the new table having no comments.
621
-
</para>
622
-
<para>
623
-
<literal>INCLUDING ALL</literal> is an abbreviated form of
624
-
<literal>INCLUDING COMMENTS INCLUDING CONSTRAINTS INCLUDING DEFAULTS INCLUDING IDENTITY INCLUDING INDEXES INCLUDING STATISTICS INCLUDING STORAGE</literal>.
625
-
</para>
626
-
<para>
627
-
Note that unlike <literal>INHERITS</literal>, columns and
573
+
<para>
574
+
Also unlike <literal>INHERITS</literal>, columns and
628
575
constraints copied by <literal>LIKE</literal> are not merged with similarly
629
576
named columns and constraints.
630
577
If the same name is specified explicitly or in another
631
578
<literal>LIKE</literal> clause, an error is signaled.
632
579
</para>
580
+
<para>
581
+
The optional <replaceable>like_option</replaceable> clauses specify
582
+
which additional properties of the original table to copy. Specifying
583
+
<literal>INCLUDING</literal> copies the property, specifying
584
+
<literal>EXCLUDING</literal> omits the property.
585
+
<literal>EXCLUDING</literal> is the default. If multiple specifications
586
+
are made for the same kind of object, the last one is used. The
0 commit comments