mirror of
https://github.com/postgres/postgres.git
synced 2025-07-14 08:21:07 +03:00
Implement CREATE TABLE LIKE ... INCLUDING INDEXES. Patch from NikhilS,
based in part on an earlier patch from Trevor Hardcastle, and reviewed by myself.
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
<!--
|
||||
$PostgreSQL: pgsql/doc/src/sgml/ref/create_table.sgml,v 1.108 2007/06/03 17:06:03 tgl Exp $
|
||||
$PostgreSQL: pgsql/doc/src/sgml/ref/create_table.sgml,v 1.109 2007/07/17 05:02:00 neilc Exp $
|
||||
PostgreSQL documentation
|
||||
-->
|
||||
|
||||
@ -23,7 +23,7 @@ PostgreSQL documentation
|
||||
CREATE [ [ GLOBAL | LOCAL ] { TEMPORARY | TEMP } ] TABLE <replaceable class="PARAMETER">table_name</replaceable> ( [
|
||||
{ <replaceable class="PARAMETER">column_name</replaceable> <replaceable class="PARAMETER">data_type</replaceable> [ DEFAULT <replaceable>default_expr</> ] [ <replaceable class="PARAMETER">column_constraint</replaceable> [ ... ] ]
|
||||
| <replaceable>table_constraint</replaceable>
|
||||
| LIKE <replaceable>parent_table</replaceable> [ { INCLUDING | EXCLUDING } { DEFAULTS | CONSTRAINTS } ] ... }
|
||||
| LIKE <replaceable>parent_table</replaceable> [ { INCLUDING | EXCLUDING } { DEFAULTS | CONSTRAINTS | INDEXES } ] ... }
|
||||
[, ... ]
|
||||
] )
|
||||
[ INHERITS ( <replaceable>parent_table</replaceable> [, ... ] ) ]
|
||||
@ -237,7 +237,7 @@ and <replaceable class="PARAMETER">table_constraint</replaceable> is:
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><literal>LIKE <replaceable>parent_table</replaceable> [ { INCLUDING | EXCLUDING } { DEFAULTS | CONSTRAINTS } ]</literal></term>
|
||||
<term><literal>LIKE <replaceable>parent_table</replaceable> [ { INCLUDING | EXCLUDING } { DEFAULTS | CONSTRAINTS | INDEXES } ]</literal></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The <literal>LIKE</literal> clause specifies a table from which
|
||||
@ -265,11 +265,16 @@ and <replaceable class="PARAMETER">table_constraint</replaceable> is:
|
||||
column constraints and table constraints — when constraints are
|
||||
requested, all check constraints are copied.
|
||||
</para>
|
||||
<para>
|
||||
Any indexes on the original table will not be created on the new
|
||||
table, unless the <literal>INCLUDING INDEXES</literal> clause is
|
||||
specified.
|
||||
</para>
|
||||
<para>
|
||||
Note also that unlike <literal>INHERITS</literal>, copied columns and
|
||||
constraints are not merged with similarly named columns and constraints.
|
||||
If the same name is specified explicitly or in another
|
||||
<literal>LIKE</literal> clause an error is signalled.
|
||||
<literal>LIKE</literal> clause, an error is signalled.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
Reference in New Issue
Block a user