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

From Scott Marlowe
Subject Re: Explicitly inserting NULL values into NOT NULL DEFAULT 0 columns
Date
Msg-id CAOR=d=3dK4wj9808hneDV5T4yO1qErsQL6=FMm0_XFi1O7DPyA@mail.gmail.com
Whole thread Raw
In response to Explicitly inserting NULL values into NOT NULL DEFAULT 0 columns  (Tanmay Patel <tan.patel.may@gmail.com>)
Responses Re: Explicitly inserting NULL values into NOT NULL DEFAULT 0 columns  (Etienne Rouxel <rouxel.etienne@gmail.com>)
List pgsql-general
On Mon, Nov 21, 2011 at 5:27 PM, Tanmay Patel <tan.patel.may@gmail.com> wrote:
> 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.

As Tom pointed out you are mistaken.  That's a MySQLism.  If you want
to insert defaults, use the DEFAULT keyword in place of where you're
trying to put NULL.

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Explicitly inserting NULL values into NOT NULL DEFAULT 0 columns
Next
From: Ashesh Vashi
Date:
Subject: Re: Installing postgresql on windows 7