check_constraint_accross_table_note_v5.patch

text/x-patch

Filename: check_constraint_accross_table_note_v5.patch
Type: text/x-patch
Part: 0
Message: Re: Constraint documentation

Patch

Format: unified
Series: patch v5
File+
doc/src/sgml/ddl.sgml 14 0
diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml
index b5ed1b7939..142918e2b1 100644
--- a/doc/src/sgml/ddl.sgml
+++ b/doc/src/sgml/ddl.sgml
@@ -403,6 +403,20 @@ CREATE TABLE products (
     ensure that a column does not contain null values, the not-null
     constraint described in the next section can be used.
    </para>
+
+   <note>
+    <para>
+     <productname>PostgreSQL</productname> does not support writing
+     <literal>CHECK</literal> constraints that reference tables (though it does
+     not reliably prevent one from doing so).  While normal operations are
+     likely to succeed even if you violate this rule, it is probable that a
+     database restoration will fail.  Use <literal>FOREIGN KEY</literal>
+     constraints or custom <link linkend="triggers">triggers</link> for
+     cross-table validations.  For rows on the same table you should use
+     <literal>UNIQUE</literal> or <literal>EXCLUDE</literal> constraints when
+     applicable, or a custom trigger otherwise.
+    </para>
+   </note>
   </sect2>
 
   <sect2>