Strange ADD CHECK error message

From: "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au>
To: "Hackers" <pgsql-hackers(at)postgresql(dot)org>, <sszabo(at)megazone23(dot)bigpanda(dot)com>
Subject: Strange ADD CHECK error message
Date: 2001-11-15 07:15:30
Message-ID: GNELIHDDFBOCMGBFGEFOEEHACAAA.chriskl@familyhealth.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I have noticed a strange error message when adding check constraints.
Basically the ADD CHECK below is failing because the field it is trying to
force to be NOT NULL already has NULL values in it. However, the error
message it produces is quite cryptic and it took me a while to figure out
what was going on.

Is it still like this in 7.2b2, and should it be changed?

Chris

test=# select version();
version
--------------------------------------------------------------
PostgreSQL 7.1.3 on i386--freebsd4.2, compiled by GCC 2.95.2
(1 row)
test=# create table test (foo char(1) check (foo in ('M', 'V')));
CREATE
test=# insert into test values('M');
INSERT 2823326 1
test=# alter table test add column bar varchar(255);
ALTER
test=# alter table test add check (bar is not null);
ERROR: AlterTableAddConstraint: rejected due to CHECK constraint <unnamed>

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Stephan Szabo 2001-11-15 07:44:10 Re: Strange ADD CHECK error message
Previous Message Tom Lane 2001-11-15 05:46:19 Re: Shared memory use?