check_constraint_accross_table_note_v3.patch
text/x-patch
Filename: check_constraint_accross_table_note_v3.patch
Type: text/x-patch
Part: 0
Message:
Re: Constraint documentation
Patch
Format: unified
Series: patch v3
| File | + | − |
|---|---|---|
| doc/src/sgml/ddl.sgml | 12 | 0 |
diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml
index 50dc25f..d7cc1d9 100644
--- a/doc/src/sgml/ddl.sgml
+++ b/doc/src/sgml/ddl.sgml
@@ -403,6 +403,18 @@ 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>
+ Check constraints are not designed to enforce business rules across tables.
+ Avoid using check constraints with a function accessing other tables and
+ use <xref linkend="triggers"/> instead. Although PostgreSQL won't prevent you
+ from doing so, beware that dumps generated by <application>pg_dump</application>
+ or <application>pg_dumpall</application> may be hard
+ to restore because of such checks, as the underlying dependencies are not
+ taken into account.
+ </para>
+ </note>
</sect2>
<sect2>