Re: HOW TO HANDLE ZEROS IN DATE FIELD?

From: Michael Glaesemann <grzm(at)myrealbox(dot)com>
To: "James M Doherty" <jim(at)jdoherty(dot)net>
Cc: <pgsql-sql(at)postgresql(dot)org>
Subject: Re: HOW TO HANDLE ZEROS IN DATE FIELD?
Date: 2004-09-11 05:44:02
Message-ID: 9622DF32-03B5-11D9-9715-000A95C88220@myrealbox.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2004-09-11 06:03:30 Re: PL/pgSQL Function Problem
Previous Message Bruce Momjian 2004-09-10 21:48:30 Re: aggregate function stddev