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