pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: andras.vaczi@zalando.de
To: pgsql-bugs@postgresql.org
Subject: BUG #8141: multi-column check expression evaluating to NULL
Date: Wed, 08 May 2013 13:07:00 +0000
Message-ID: <E1Ua45E-0001tQ-Dd@wrigleys.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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 >= 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.



-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (3+ messages)  latest in thread

Message-ID: <E1Ua45E-0001tQ-Dd@wrigleys.postgresql.org>
Permalink:  ../E1Ua45E-0001tQ-Dd@wrigleys.postgresql.org/
Also on:    postgresql.org/message-id/E1Ua45E-0001tQ-Dd@wrigleys.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: andras.vaczi@zalando.de
  Subject: Re: BUG #8141: multi-column check expression evaluating to NULL
  In-Reply-To: <E1Ua45E-0001tQ-Dd@wrigleys.postgresql.org>
  References: <E1Ua45E-0001tQ-Dd@wrigleys.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox