BUG #8141: multi-column check expression evaluating to NULL - Mailing list pgsql-bugs

From andras.vaczi@zalando.de
Subject BUG #8141: multi-column check expression evaluating to NULL
Date
Msg-id E1Ua45E-0001tQ-Dd@wrigleys.postgresql.org
Whole thread Raw
Responses Re: BUG #8141: multi-column check expression evaluating to NULL  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: BUG #8141: multi-column check expression evaluating to NULL  (Gavin Flower <GavinFlower@archidevsys.co.nz>)
List pgsql-bugs
The following bug has been logged on the website:

Bug reference:      8141
Logged by:          Andras Vaczi
Email address:      andras.vaczi@zalando.de
PostgreSQL version: 9.1.9
Operating system:   linux/Ubuntu 12.10
Description:        =


Consider the following table with a CHECK constraint:

CREATE TABLE check_test
(
  id integer NOT NULL,
  col integer,
  CONSTRAINT unique_with_null_check1 CHECK (col >=3D 1 AND id < 20)
);

This INSERT statement succeeds:

INSERT INTO check_test (id, col) VALUES (1, NULL);

While, col being NULL, the whole CHECK condition evaluates to NULL - this is
covered in the documentation.

But this is refused:
INSERT INTO check_test (id, col) VALUES (21, NULL);

ERROR:  new row for relation "check_test" violates check constraint
"unique_with_null_check1"

I think this behaviour should be either also mentioned in the docs or
cosidered a bug.

pgsql-bugs by date:

Previous
From: workshop@qualcom.ie
Date:
Subject: BUG #8140: wont start automatically
Next
From: Tom Lane
Date:
Subject: Re: BUG #8141: multi-column check expression evaluating to NULL