@@ -329,51 +329,60 @@ CREATE [ [ GLOBAL | LOCAL ] { TEMPORARY | TEMP } | UNLOGGED ] TABLE [ IF NOT EXI
329
329
table.
330
330
</para>
331
331
<para>
332
- Default expressions for the copied column definitions will only be
333
- copied if <literal>INCLUDING DEFAULTS</literal> is specified. The
332
+ Default expressions for the copied column definitions will be copied
333
+ only if <literal>INCLUDING DEFAULTS</literal> is specified. The
334
334
default behavior is to exclude default expressions, resulting in the
335
335
copied columns in the new table having null defaults.
336
+ Note that copying defaults that call database-modification functions,
337
+ such as <function>nextval</>, may create a functional linkage between
338
+ the original and new tables.
336
339
</para>
337
340
<para>
338
341
Not-null constraints are always copied to the new table.
339
- <literal>CHECK</literal> constraints will only be copied if
340
- <literal>INCLUDING CONSTRAINTS</literal> is specified; other types of
341
- constraints will never be copied. Also, no distinction is made between
342
- column constraints and table constraints — when constraints are
343
- requested, all check constraints are copied.
342
+ <literal>CHECK</literal> constraints will be copied only if
343
+ <literal>INCLUDING CONSTRAINTS</literal> is specified.
344
+ No distinction is made between column constraints and table
345
+ constraints.
344
346
</para>
345
347
<para>
346
- Any indexes on the original table will not be created on the new
347
- table, unless the <literal>INCLUDING INDEXES</literal> clause is
348
- specified.
348
+ Indexes, <literal>PRIMARY KEY</>, <literal>UNIQUE</>,
349
+ and <literal>EXCLUDE</> constraints on the original table will be
350
+ created on the new table only if <literal>INCLUDING INDEXES</literal>
351
+ is specified. Names for the new indexes and constraints are
352
+ chosen according to the default rules, regardless of how the originals
353
+ were named. (This behavior avoids possible duplicate-name failures for
354
+ the new indexes.)
349
355
</para>
350
- <para><literal>STORAGE</> settings for the copied column definitions will only
351
- be copied if <literal>INCLUDING STORAGE</literal> is specified. The
356
+ <para>
357
+ <literal>STORAGE</> settings for the copied column definitions will be
358
+ copied only if <literal>INCLUDING STORAGE</literal> is specified. The
352
359
default behavior is to exclude <literal>STORAGE</> settings, resulting
353
360
in the copied columns in the new table having type-specific default
354
361
settings. For more on <literal>STORAGE</> settings, see
355
362
<xref linkend="storage-toast">.
356
363
</para>
357
364
<para>
358
365
Comments for the copied columns, constraints, and indexes
359
- will only be copied if <literal>INCLUDING COMMENTS</literal>
366
+ will be copied only if <literal>INCLUDING COMMENTS</literal>
360
367
is specified. The default behavior is to exclude comments, resulting in
361
368
the copied columns and constraints in the new table having no comments.
362
369
</para>
363
- <para><literal>INCLUDING ALL</literal> is an abbreviated form of
370
+ <para>
371
+ <literal>INCLUDING ALL</literal> is an abbreviated form of
364
372
<literal>INCLUDING DEFAULTS INCLUDING CONSTRAINTS INCLUDING INDEXES INCLUDING STORAGE INCLUDING COMMENTS</literal>.
365
373
</para>
366
374
<para>
367
- Note also that unlike <literal>INHERITS</literal>, columns and
375
+ Note that unlike <literal>INHERITS</literal>, columns and
368
376
constraints copied by <literal>LIKE</> are not merged with similarly
369
377
named columns and constraints.
370
378
If the same name is specified explicitly or in another
371
- <literal>LIKE</literal> clause, an error is signalled .
379
+ <literal>LIKE</literal> clause, an error is signaled .
372
380
</para>
373
381
<para>
374
- The <literal>LIKE</literal> clause can also be used to copy columns from
375
- views, foreign tables, or composite types. Inapplicable options (e.g., <literal>INCLUDING
376
- INDEXES</literal> from a view) are ignored.
382
+ The <literal>LIKE</literal> clause can also be used to copy column
383
+ definitions from views, foreign tables, or composite types.
384
+ Inapplicable options (e.g., <literal>INCLUDING INDEXES</literal> from
385
+ a view) are ignored.
377
386
</para>
378
387
</listitem>
379
388
</varlistentry>
@@ -1408,6 +1417,17 @@ CREATE TABLE employees OF employee_type (
1408
1417
</para>
1409
1418
</refsect2>
1410
1419
1420
+ <refsect2>
1421
+ <title><literal>LIKE</> Clause</title>
1422
+
1423
+ <para>
1424
+ While a <literal>LIKE</> clause exists in the SQL standard, many of the
1425
+ options that <productname>PostgreSQL</productname> accepts for it are not
1426
+ in the standard, and some of the standard's options are not implemented
1427
+ by <productname>PostgreSQL</productname>.
1428
+ </para>
1429
+ </refsect2>
1430
+
1411
1431
<refsect2>
1412
1432
<title><literal>WITH</> Clause</title>
1413
1433
0 commit comments