diff options
author | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2011-12-05 15:10:18 -0300 |
---|---|---|
committer | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2011-12-19 17:30:23 -0300 |
commit | 61d81bd28dbec65a6b144e0cd3d0bfe25913c3ac (patch) | |
tree | bc99d53c06bed6dcc146f7eb97babba998eb5e1d /doc/src | |
parent | 92203624934095163f8b57b5b3d7bbd2645da2c8 (diff) | |
download | postgresql-61d81bd28dbec65a6b144e0cd3d0bfe25913c3ac.tar.gz postgresql-61d81bd28dbec65a6b144e0cd3d0bfe25913c3ac.zip |
Allow CHECK constraints to be declared ONLY
This makes them enforceable only on the parent table, not on children
tables. This is useful in various situations, per discussion involving
people bitten by the restrictive behavior introduced in 8.4.
Message-Id:
8762mp93iw.fsf@comcast.net
CAFaPBrSMMpubkGf4zcRL_YL-AERUbYF_-ZNNYfb3CVwwEqc9TQ@mail.gmail.com
Authors: Nikhil Sontakke, Alex Hunsaker
Reviewed by Robert Haas and myself
Diffstat (limited to 'doc/src')
-rw-r--r-- | doc/src/sgml/catalogs.sgml | 10 | ||||
-rw-r--r-- | doc/src/sgml/ref/alter_table.sgml | 8 |
2 files changed, 18 insertions, 0 deletions
diff --git a/doc/src/sgml/catalogs.sgml b/doc/src/sgml/catalogs.sgml index d948ed487c6..be4bbc736c7 100644 --- a/doc/src/sgml/catalogs.sgml +++ b/doc/src/sgml/catalogs.sgml @@ -2037,6 +2037,16 @@ </row> <row> + <entry><structfield>conisonly</structfield></entry> + <entry><type>bool</type></entry> + <entry></entry> + <entry> + This constraint is defined locally for the relation. It is a + non-inheritable constraint. + </entry> + </row> + + <row> <entry><structfield>conkey</structfield></entry> <entry><type>int2[]</type></entry> <entry><literal><link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.attnum</></entry> diff --git a/doc/src/sgml/ref/alter_table.sgml b/doc/src/sgml/ref/alter_table.sgml index 00a477ef885..3b111a4c2b9 100644 --- a/doc/src/sgml/ref/alter_table.sgml +++ b/doc/src/sgml/ref/alter_table.sgml @@ -984,6 +984,14 @@ ALTER TABLE distributors ADD CONSTRAINT zipchk CHECK (char_length(zipcode) = 5); </para> <para> + To add a check constraint only to a table and not to its children: +<programlisting> +ALTER TABLE ONLY distributors ADD CONSTRAINT zipchk CHECK (char_length(zipcode) = 5); +</programlisting> + (The check constraint will not be inherited by future children, either.) + </para> + + <para> To remove a check constraint from a table and all its children: <programlisting> ALTER TABLE distributors DROP CONSTRAINT zipchk; |