From: Michael Glaesemann <grzm@myrealbox.com>
To: James M Doherty <jim@jdoherty.net>
Cc: pgsql-sql@postgresql.org
Subject: Re: HOW TO HANDLE ZEROS IN DATE FIELD?
Date: Sat, 11 Sep 2004 14:44:02 +0900
Message-ID: <9622DF32-03B5-11D9-9715-000A95C88220@myrealbox.com> (raw)
In-Reply-To: <000401c491c3$6f4ca240$68363c90@ad.tri.sbc.com>
References: <000401c491c3$6f4ca240$68363c90@ad.tri.sbc.com>
On Sep 3, 2004, at 11:36 PM, James M Doherty wrote:
> I have a project that is taking input from another system. I have
> certain
> columns defined as 'Date'
>
> Columns. On input I will get '000000' in this field which causes the
> insert
> to fail. I have read the
>
> docs on default and it is unclear to me if this will work. Does anyone
> have
> experience in solving
>
> this problem. The other alternative I thought of was to write a
> trigger to
> fix it ??
000000 is not a valid date, as you are aware :) This is often solved in
the application layer by preprocessing the data, changing 000000 to
NULL, for example. You may be able to do some of this preprocessing in
the database itself, first loading the raw data into a temporary table
and then transforming it before putting it into the desired table.
Michael Glaesemann
grzm myrealbox com
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: grzm@myrealbox.com, jim@jdoherty.net
Subject: Re: HOW TO HANDLE ZEROS IN DATE FIELD?
In-Reply-To: <9622DF32-03B5-11D9-9715-000A95C88220@myrealbox.com>
References: <000401c491c3$6f4ca240$68363c90@ad.tri.sbc.com> <9622DF32-03B5-11D9-9715-000A95C88220@myrealbox.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox