Some more doc patches for partitioned tables. In particular replace the caveat
that INCLUDING CONSTRAINTS doesn't exist and replace it with documentation of,
well, INCLUDING CONSTRAINTS.
Also, there was an instance of LIKE WITH DEFAULTS which is actually spelled
LIKE INCLUDING DEFAULTS.
*** ddl.sgml05 Sep 2006 22:08:33 +0100 1.61
--- ddl.sgml19 Sep 2006 10:41:18 +0100
***
*** 2083,2093
para
One convenient way to create a compatible table to be a new child is using
the commandLIKE/command option of commandCREATE TABLE/command. This
!creates a table with the same columns with the same type (however note the
!caveat below regarding constraints). Alternatively a compatible table can
!be created by first creating a new child using commandCREATE
!TABLE/command then removing the inheritance link with commandALTER
!TABLE/command.
/para
para
--- 2083,2096
para
One convenient way to create a compatible table to be a new child is using
the commandLIKE/command option of commandCREATE TABLE/command. This
!creates a table with the same columns with the same type. If there are any
!commandCHECK/command constraints defined on the parent table
!the commandINCLUDING CONSTRAINTS/command option
!to commandLIKE/command may be useful as the new child must have
!constraints matching the parentto be considered compatible. Alternatively a
!compatible table can be created by first creating a new child
!using commandCREATE TABLE/command then removing the inheritance link
!with commandALTER TABLE/command.
/para
para
***
*** 2161,2179
listitem
para
- There is no convenient way to define a table compatible with a specific
- parent including columns and constraints. The commandLIKE/command
- option for commandCREATE TABLE/command does not copy constraints
- which makes the tables it creates ineligible for being added using
- commandALTER TABLE/command. Matching check constraints must be
added
- manually or the table must be created as a child immediately, then if
- needed removed from the inheritance structure temporarily to be added
- again later.
- /para
- /listitem
-
- listitem
- para
If a table is ever removed from the inheritance structure using
commandALTER TABLE/command then all its columns will be marked as
being locally defined. This means commandDROP COLUMN/command on the
--- 2164,2169
***
*** 2577,2632
constraint for its partition.
/para
/listitem
! listitem
!para
! When the time comes to archive and remove the old data we first remove
! it from the production table using:
programlisting
ALTER TABLE measurement_y2003mm02 NO INHERIT measurement
/programlisting
! Then we can perform any sort of data modification necessary prior to
! archiving without impacting the data viewed by the production system.
! This could include, for example, deleting or compressing out redundant
! data.
!/para
! /listitem
! listitem
! para
!Similarly we can a new partition to handle new data. We can either
!create an empty partition as the original partitions were created
!above, or for some applications it's necessary to bulk load and clean
!data for the new partition. If that operation involves multiple steps
!by different processes it can be helpful to work with it in a fresh
!table outside of the master partitioned table until it's ready to be
!loaded:
programlisting
! CREATE TABLE measurement_y2006m02 (LIKE measurement WITH DEFAULTS);
\COPY measurement_y2006m02 FROM 'measurement_y2006m02'
UPDATE ...
ALTER TABLE measurement_y2006m02 ADD CONSTRAINT y2006m02 CHECK ( logdate
gt;= DATE '2006-02-01' AND logdate lt DATE '2006-03-01' );
ALTER TABLE measurement_y2006m02 INHERIT MEASUREMENT;
/programlisting
- /para
- /listitem
-
- /orderedlist
/para
- para
- As we can see, a complex partitioning scheme could require a
- substantial amount of DDL. In the above example we would be
- creating a new partition each month, so it may be wise to write a
- script that generates the required DDL automatically.
- /para
para
! The following caveats apply:
itemizedlist
listitem
para
--- 2567,2654
constraint for its partition.
/para
/listitem
+ /orderedlist
+ /para
! para
! As we can see, a complex partitioning scheme could require a
! substantial amount of DDL. In the above example we would be
! creating a new partition each month, so it may be wise to write a
! script that generates the required DDL automatically.
!