Re: Why is default value not working on insert? - Mailing list pgsql-general

From Ian Barwick
Subject Re: Why is default value not working on insert?
Date
Msg-id 1d581afe0608081353t15a37126l2d8ecf2fcba2b247@mail.gmail.com
Whole thread Raw
In response to Why is default value not working on insert?  ("Chris Hoover" <revoohc@gmail.com>)
List pgsql-general
2006/8/8, Chris Hoover <revoohc@gmail.com>:
(...)
> The reason for the null being passed to to_date is this is on of almot 90k
> lines of data we are trying to load, and the script was built to generate
> this code.  Since to_date(null,'yyyymmdd') returns a null, why is the
> default not working?

Because you're trying to explicitly insert a NULL into a column which
is specified as NOT NULL.

(If you can't change the script to output DEFAULT or the explicit
default value, the best workaraound would be to create a trigger which
converts any attempt to insert a NULL value into that column to the
intended default value).


Ian Barwick

pgsql-general by date:

Previous
From: "Chris Hoover"
Date:
Subject: Why is default value not working on insert?
Next
From: Martijn van Oosterhout
Date:
Subject: Re: Why is default value not working on insert?