Re: ALTER TABLE Column NOT NULL?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: ALTER TABLE Column NOT NULL?
Дата
Msg-id 5216.1011991056@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: ALTER TABLE Column NOT NULL?  (Alvaro Herrera <alvherre@atentus.com>)
Список 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 по дате отправления:

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: ALTER TABLE Column NOT NULL?
Следующее
От: Chris "Boz" Jennings
Дата:
Сообщение: Orionserver, CMP and PostgreSQL