null constraints and defaults

Поиск
Список
Период
Сортировка
От elein@varlena.com (elein)
Тема null constraints and defaults
Дата
Msg-id 20050629200415.GD7997@varlena.com
обсуждение исходный текст
Ответы Re: null constraints and defaults  (Matt Miller <mattm@epx.com>)
Re: null constraints and defaults  (Stephan Szabo <sszabo@megazone.bigpanda.com>)
Список pgsql-general
It seems that the not null constraint is applied
before the default constraint if a column is
defined with both default and not null.

I understand that default should make the
the NOT NULL constraint unnecessary. But still....

Is this the intended behaviour?


create table nulldefault ( one integer NOT NULL default 1 );
CREATE TABLE
                                 ^
elein=# insert into nulldefault values (NULL);
ERROR:  null value in column "one" violates not-null constraint

elein=# create table defaultnull (one integer default 1);
CREATE TABLE
elein=# insert into defaultnull values (NULL);
INSERT 4681559 1

--elein
elein@varlena.com

В списке pgsql-general по дате отправления:

Предыдущее
От: D A GERM
Дата:
Сообщение: Re: Need help writing SQL statement
Следующее
От: Sven Willenberger
Дата:
Сообщение: Re: PostgreSQL's vacuumdb fails to allocate memory for