@@ -328,48 +328,60 @@ CREATE [ [ GLOBAL | LOCAL ] { TEMPORARY | TEMP } | UNLOGGED ] TABLE [ IF NOT EXI
328
328
table.
329
329
</para>
330
330
<para>
331
- Default expressions for the copied column definitions will only be
332
- copied if <literal>INCLUDING DEFAULTS</literal> is specified. The
331
+ Default expressions for the copied column definitions will be copied
332
+ only if <literal>INCLUDING DEFAULTS</literal> is specified. The
333
333
default behavior is to exclude default expressions, resulting in the
334
334
copied columns in the new table having null defaults.
335
+ Note that copying defaults that call database-modification functions,
336
+ such as <function>nextval</>, may create a functional linkage between
337
+ the original and new tables.
335
338
</para>
336
339
<para>
337
340
Not-null constraints are always copied to the new table.
338
341
<literal>CHECK</literal> constraints will be copied only if
339
342
<literal>INCLUDING CONSTRAINTS</literal> is specified.
340
- Indexes, <literal>PRIMARY KEY</>, and <literal>UNIQUE</> constraints
341
- on the original table will be created on the new table only if the
342
- <literal>INCLUDING INDEXES</literal> clause is specified.
343
343
No distinction is made between column constraints and table
344
344
constraints.
345
345
</para>
346
- <para><literal>STORAGE</> settings for the copied column definitions will only
347
- be copied if <literal>INCLUDING STORAGE</literal> is specified. The
346
+ <para>
347
+ Indexes, <literal>PRIMARY KEY</>, <literal>UNIQUE</>,
348
+ and <literal>EXCLUDE</> constraints on the original table will be
349
+ created on the new table only if <literal>INCLUDING INDEXES</literal>
350
+ is specified. Names for the new indexes and constraints are
351
+ chosen according to the default rules, regardless of how the originals
352
+ were named. (This behavior avoids possible duplicate-name failures for
353
+ the new indexes.)
354
+ </para>
355
+ <para>
356
+ <literal>STORAGE</> settings for the copied column definitions will be
357
+ copied only if <literal>INCLUDING STORAGE</literal> is specified. The
348
358
default behavior is to exclude <literal>STORAGE</> settings, resulting
349
359
in the copied columns in the new table having type-specific default
350
360
settings. For more on <literal>STORAGE</> settings, see
351
361
<xref linkend="storage-toast">.
352
362
</para>
353
363
<para>
354
364
Comments for the copied columns, constraints, and indexes
355
- will only be copied if <literal>INCLUDING COMMENTS</literal>
365
+ will be copied only if <literal>INCLUDING COMMENTS</literal>
356
366
is specified. The default behavior is to exclude comments, resulting in
357
367
the copied columns and constraints in the new table having no comments.
358
368
</para>
359
- <para><literal>INCLUDING ALL</literal> is an abbreviated form of
369
+ <para>
370
+ <literal>INCLUDING ALL</literal> is an abbreviated form of
360
371
<literal>INCLUDING DEFAULTS INCLUDING CONSTRAINTS INCLUDING INDEXES INCLUDING STORAGE INCLUDING COMMENTS</literal>.
361
372
</para>
362
373
<para>
363
- Note also that unlike <literal>INHERITS</literal>, columns and
374
+ Note that unlike <literal>INHERITS</literal>, columns and
364
375
constraints copied by <literal>LIKE</> are not merged with similarly
365
376
named columns and constraints.
366
377
If the same name is specified explicitly or in another
367
378
<literal>LIKE</literal> clause, an error is signaled.
368
379
</para>
369
380
<para>
370
- The <literal>LIKE</literal> clause can also be used to copy columns from
371
- views, foreign tables, or composite types. Inapplicable options (e.g., <literal>INCLUDING
372
- INDEXES</literal> from a view) are ignored.
381
+ The <literal>LIKE</literal> clause can also be used to copy column
382
+ definitions from views, foreign tables, or composite types.
383
+ Inapplicable options (e.g., <literal>INCLUDING INDEXES</literal> from
384
+ a view) are ignored.
373
385
</para>
374
386
</listitem>
375
387
</varlistentry>
@@ -1444,6 +1456,17 @@ CREATE TABLE employees OF employee_type (
1444
1456
</para>
1445
1457
</refsect2>
1446
1458
1459
+ <refsect2>
1460
+ <title><literal>LIKE</> Clause</title>
1461
+
1462
+ <para>
1463
+ While a <literal>LIKE</> clause exists in the SQL standard, many of the
1464
+ options that <productname>PostgreSQL</productname> accepts for it are not
1465
+ in the standard, and some of the standard's options are not implemented
1466
+ by <productname>PostgreSQL</productname>.
1467
+ </para>
1468
+ </refsect2>
1469
+
1447
1470
<refsect2>
1448
1471
<title><literal>WITH</> Clause</title>
1449
1472
0 commit comments