Explicitly inserting NULL values into NOT NULL DEFAULT 0 columns - Mailing list pgsql-general

From Tanmay Patel
Subject Explicitly inserting NULL values into NOT NULL DEFAULT 0 columns
Date
Msg-id CAGgjfiTX+m1DKxSti7EQXdCgO-swqEF28kf=g6Jv9RK=KkWTqA@mail.gmail.com
Whole thread Raw
Responses Re: Explicitly inserting NULL values into NOT NULL DEFAULT 0 columns
Re: Explicitly inserting NULL values into NOT NULL DEFAULT 0 columns
List pgsql-general
If I insert a NULL value explicitly into a column declared to be NOT NULL DEFAULT 0 in postgreSQL 8.4 the column ends up with the default value. If I do the same in postgreSQL 9.0 I get an error about how I am inserting a null value into a NOT NULL column.

i.e.: insert into table1 (column1, column2) values (0, NULL); where column2 is of type integer with attributes NOT NULL DEFAULT 0

In both cases if I just don't mention the column with these attributes the value stored is the default value.

i.e.: insert into table1(column1) values (0); where column2 is of type integer with attributes NOT NULL DEFAULT 0

I looked through all the release notes between the versions in question and can find nothing mentioning this change. When did this change occur, and can I choose to keep the behavior as it was in postgreSQL 8.4?

Thanks,

Tanmay

pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: how could duplicate pkey exist in psql?
Next
From: Pavel Stehule
Date:
Subject: Re: stored function data structures - difficulty