Check constraints do not seem to be working!!! - Mailing list pgsql-general

From Jitendra Loyal
Subject Check constraints do not seem to be working!!!
Date
Msg-id CAGBkusdqR7ZuovjZmqCwN913=PRCTmnUjT3KdEyXCr3z74BNoQ@mail.gmail.com
Whole thread Raw
Responses Re: Check constraints do not seem to be working!!!  (Chris Sterritt <chris.sterritt@yobota.xyz>)
Re: Check constraints do not seem to be working!!!  (Nikolay Samokhvalov <samokhvalov@gmail.com>)
List pgsql-general
Consider this table definition:
         create table t ( i serial, b bool, c bool,
                                constraint b_c check ( (b = true and c is not null ) or (b is distinct
from true and c is null) )
                                constraint b_c check ( (b = true and c is not null ) or (b = false and c
is null) or (b is null and c is null) )
                                );
Despite the above two constraints, the following rows get into the table:
     insert into t (b , c) values (null, true), (null, false);  

pgsql-general by date:

Previous
From: Peter Coppens
Date:
Subject: Re: Execution plan does not use index
Next
From: Chris Sterritt
Date:
Subject: Re: Check constraints do not seem to be working!!!