null constraints and defaults
| От | elein@varlena.com (elein) |
|---|---|
| Тема | null constraints and defaults |
| Дата | |
| Msg-id | 20050629200415.GD7997@varlena.com обсуждение исходный текст |
| Ответы |
Re: null constraints and defaults
Re: null constraints and defaults |
| Список | 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 по дате отправления: