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@xxxxxxxxxxx ---------------------------(end of broadcast)--------------------------- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match