From dc2c25fc6246866ce809a8b6bf1d2a2856334b54 Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Tue, 27 Jun 2006 03:43:20 +0000 Subject: Add INCLUDING CONSTRAINTS to CREATE TABLE LIKE. Greg Stark --- doc/src/sgml/ref/create_table.sgml | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'doc/src') diff --git a/doc/src/sgml/ref/create_table.sgml b/doc/src/sgml/ref/create_table.sgml index a4cdc250187..916f0c8b568 100644 --- a/doc/src/sgml/ref/create_table.sgml +++ b/doc/src/sgml/ref/create_table.sgml @@ -1,5 +1,5 @@ @@ -23,7 +23,7 @@ PostgreSQL documentation CREATE [ [ GLOBAL | LOCAL ] { TEMPORARY | TEMP } ] TABLE table_name ( [ { column_name data_type [ DEFAULT default_expr ] [ column_constraint [ ... ] ] | table_constraint - | LIKE parent_table [ { INCLUDING | EXCLUDING } DEFAULTS ] } + | LIKE parent_table [ { INCLUDING | EXCLUDING } { DEFAULTS | CONSTRAINTS } ] ... } [, ... ] ] ) [ INHERITS ( parent_table [, ... ] ) ] @@ -232,7 +232,7 @@ and table_constraint is: - LIKE parent_table [ { INCLUDING | EXCLUDING } DEFAULTS ] + LIKE parent_table [ { INCLUDING | EXCLUDING } { DEFAULTS | CONSTRAINTS } ] The LIKE clause specifies a table from which @@ -252,6 +252,20 @@ and table_constraint is: default behavior is to exclude default expressions, resulting in all columns of the new table having null defaults. + + Likewise constraints for the copied column definitions will only be + copied if INCLUDING CONSTRAINTS is specified. Note + that currently even when INCLUDING CONSTRAINTS is specified + only CHECK constraints are copied. Also, no distinction is made between + column constraints and table constraints -- when constraints are + requested all check constraints are copied. + + + Note also that unlike INHERITS copied columns and + constraints are not merged with similarly named columns and constraints. + If the same name is specified explicitly or in another + LIKE clause an error is signalled. + -- cgit v1.2.3