From 3b7ca96c2c5bb4caeb40a0806a9a5a936cdcdfb2 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Mon, 22 Mar 2004 16:18:50 +0000 Subject: [PATCH] Clean up rather poor description of the difference between INHERITS and LIKE. Per gripe from Patrick Samson. --- doc/src/sgml/ref/create_table.sgml | 36 +++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/doc/src/sgml/ref/create_table.sgml b/doc/src/sgml/ref/create_table.sgml index bd0ed0e596..771919f164 100644 --- a/doc/src/sgml/ref/create_table.sgml +++ b/doc/src/sgml/ref/create_table.sgml @@ -1,5 +1,5 @@ @@ -185,18 +185,20 @@ and table_constraint is: The LIKE clause specifies a table from which - the new table automatically inherits all column names, their data types, and - not-null constraints. + the new table automatically copies all column names, their data types, + and their not-null constraints. - Unlike INHERITS, the new table and inherited table - are complete decoupled after creation has been completed. Data inserted - into the new table will not be reflected into the parent table. + Unlike INHERITS, the new table and original table + are completely decoupled after creation is complete. Changes to the + 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. - Default expressions for the inherited column definitions will only be included if - INCLUDING DEFAULTS is specified. The default is to exclude - default expressions. + Default expressions for the copied column definitions will only be + included if INCLUDING DEFAULTS is specified. The + default is to exclude default expressions. @@ -207,12 +209,24 @@ and table_constraint is: The optional INHERITS clause specifies a list of tables from which the new table automatically inherits all - columns. If the same column name exists in more than one parent + columns. + + + + Use of 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). + + + + If the same column name exists in more than one parent table, an error is reported unless the data types of the columns match in each of the parent tables. If there is no conflict, then the duplicate columns are merged to form a single column in 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 definitions are merged into one. However, inherited and new column declarations of the same name need not specify identical