Commit 3b7ca96c authored by Tom Lane's avatar Tom Lane

Clean up rather poor description of the difference between INHERITS and

LIKE.  Per gripe from Patrick Samson.
parent d81cd703
<!-- <!--
$PostgreSQL: pgsql/doc/src/sgml/ref/create_table.sgml,v 1.79 2004/03/09 16:57:47 neilc Exp $ $PostgreSQL: pgsql/doc/src/sgml/ref/create_table.sgml,v 1.80 2004/03/22 16:18:50 tgl Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -185,18 +185,20 @@ and <replaceable class="PARAMETER">table_constraint</replaceable> is: ...@@ -185,18 +185,20 @@ and <replaceable class="PARAMETER">table_constraint</replaceable> is:
<listitem> <listitem>
<para> <para>
The <literal>LIKE</literal> clause specifies a table from which The <literal>LIKE</literal> clause specifies a table from which
the new table automatically inherits all column names, their data types, and the new table automatically copies all column names, their data types,
not-null constraints. and their not-null constraints.
</para> </para>
<para> <para>
Unlike <literal>INHERITS</literal>, the new table and inherited table Unlike <literal>INHERITS</literal>, the new table and original table
are complete decoupled after creation has been completed. Data inserted are completely decoupled after creation is complete. Changes to the
into the new table will not be reflected into the parent table. original table will not be applied to the new table, and it is not
possible to include data of the new table in scans of the original
table.
</para> </para>
<para> <para>
Default expressions for the inherited column definitions will only be included if Default expressions for the copied column definitions will only be
<literal>INCLUDING DEFAULTS</literal> is specified. The default is to exclude included if <literal>INCLUDING DEFAULTS</literal> is specified. The
default expressions. default is to exclude default expressions.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -207,12 +209,24 @@ and <replaceable class="PARAMETER">table_constraint</replaceable> is: ...@@ -207,12 +209,24 @@ and <replaceable class="PARAMETER">table_constraint</replaceable> is:
<para> <para>
The optional <literal>INHERITS</> clause specifies a list of The optional <literal>INHERITS</> clause specifies a list of
tables from which the new table automatically inherits all tables from which the new table automatically inherits all
columns. If the same column name exists in more than one parent columns.
</para>
<para>
Use of <literal>INHERITS</> creates a persistent relationship
between the new child table and its parent table(s). Schema
modifications to the parent(s) normally propagate to children
as well, and by default the data of the child table is included in
scans of the parent(s).
</para>
<para>
If the same column name exists in more than one parent
table, an error is reported unless the data types of the columns table, an error is reported unless the data types of the columns
match in each of the parent tables. If there is no conflict, match in each of the parent tables. If there is no conflict,
then the duplicate columns are merged to form a single column in then the duplicate columns are merged to form a single column in
the new table. If the column name list of the new table the new table. If the column name list of the new table
contains a column that is also inherited, the data type must contains a column name that is also inherited, the data type must
likewise match the inherited column(s), and the column likewise match the inherited column(s), and the column
definitions are merged into one. However, inherited and new definitions are merged into one. However, inherited and new
column declarations of the same name need not specify identical column declarations of the same name need not specify identical
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment