Re: Why is default value not working on insert?

From: "Ian Barwick" <barwick(at)gmail(dot)com>
To: "Chris Hoover" <revoohc(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Why is default value not working on insert?
Date: 2006-08-08 20:53:19
Message-ID: 1d581afe0608081353t15a37126l2d8ecf2fcba2b247@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

2006/8/8, Chris Hoover <revoohc(at)gmail(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Martijn van Oosterhout 2006-08-08 20:53:33 Re: Why is default value not working on insert?
Previous Message Chris Hoover 2006-08-08 20:41:04 Why is default value not working on insert?