| From: | elein(at)varlena(dot)com (elein) |
|---|---|
| To: | pgsql-general(at)postgresql(dot)org |
| Cc: | elein <elein(at)varlena(dot)com> |
| Subject: | null constraints and defaults |
| Date: | 2005-06-29 20:04:15 |
| Message-ID: | 20050629200415.GD7997@varlena.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | 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(at)varlena(dot)com
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Sven Willenberger | 2005-06-29 20:12:26 | Re: PostgreSQL's vacuumdb fails to allocate memory for |
| Previous Message | D A GERM | 2005-06-29 19:15:54 | Re: Need help writing SQL statement |