On Wed, Nov 11, 2020 at 12:26 AM Jitendra Loyal <jitendra.lo...@gmail.com>
wrote:

> Despite the above two constraints, the following rows get into the table:
>      insert into t (b , c) values (null, true), (null, false);
>

This behavior is described in the docs
https://www.postgresql.org/docs/current/ddl-constraints.html#DDL-CONSTRAINTS-CHECK-CONSTRAINTS
:

> It should be noted that a check constraint is satisfied if the check
expression evaluates to true or the null value. Since most expressions will
evaluate to the null value if any operand is null, they will not prevent
null values in the constrained columns. To ensure that a column does not
contain null values, the not-null constraint described in the next section
can be used.

Reply via email to