Re: ALTER TABLE Column NOT NULL? - Mailing list pgsql-general

From Tom Lane
Subject Re: ALTER TABLE Column NOT NULL?
Date
Msg-id 5216.1011991056@sss.pgh.pa.us
Whole thread Raw
In response to Re: ALTER TABLE Column NOT NULL?  (Alvaro Herrera <alvherre@atentus.com>)
List pgsql-general
Alvaro Herrera <alvherre@atentus.com> writes:
> ALTER TABLE table-name ADD CONSTRAINT constraint-name CHECK (column
> NOTNULL);

> Note that there cannot be any NULL value in the column (BTW, this is a
> good candidate for better error reporting)

regression=# create table foo (f1 text);
CREATE
regression=# insert into foo values(null);
INSERT 1999760 1
regression=# alter table foo add constraint f1_not_null check (f1 notnull);
ERROR:  AlterTableAddConstraint: rejected due to CHECK constraint f1_not_null

What's wrong with that?

            regards, tom lane

pgsql-general by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: ALTER TABLE Column NOT NULL?
Next
From: Chris "Boz" Jennings
Date:
Subject: Orionserver, CMP and PostgreSQL