On 2004.03.31 10:53 Tom Lane wrote:
> "Karl O. Pinc" <kop@meme.com> writes:
> > But SQL has 3 valued logic (strictly speaking, not boolean). It
> > seems that the CHECK clases fail only when the expression result
> > is FALSE, and pass when the result is either TRUE or UNKNOWN.
>
> Correct --- this is per spec.
>
> > Yes? Should this be clarified in the documentation?
>
> Sure, send a documentation patch.
--- create_table.sgml Wed Mar 31 12:57:02 2004
+++ create_table.sgml.new Wed Mar 31 13:16:55 2004
@@ -383,11 +383,14 @@
<para>
The <literal>CHECK</> clause specifies an expression producing a
Boolean result which new or updated rows must satisfy for an
- insert or update operation to succeed. A check constraint
- specified as a column constraint should reference that column's
- value only, while an expression appearing in a table constraint
- may reference multiple columns.
+ insert or update operation to succeed. Expressions evaluating
+ to TRUE or UNKNOWN succeed. Should any row of an insert or
+ update operation produce a FALSE result an error exception is
+ raised and the insert or update does not alter the database. A
+ check constraint specified as a column constraint should
+ reference that column's value only, while an expression
+ appearing in a table constraint may reference multiple columns.
</para>
<para>
Karl <kop@meme.com>
Free Software: "You don't pay back, you pay forward."
-- Robert A. Heinlein