Re: HOW TO HANDLE ZEROS IN DATE FIELD?

From: Michael Glaesemann <grzm(at)myrealbox(dot)com>
To: "James M Doherty (at) jdoherty(dot)net" <jim(at)jdoherty(dot)net>
Cc: 'pgsql-sql(at)postgresql(dot)org' <pgsql-sql(at)postgresql(dot)org>
Subject: Re: HOW TO HANDLE ZEROS IN DATE FIELD?
Date: 2004-09-11 12:57:23
Message-ID: 1F9FB0B8-03F2-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.

> 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.
>

I've CC'd the list as well.

On Sep 11, 2004, at 9:44 PM, James M Doherty @ jdoherty.net wrote:

> I was hoping I could do something in my insert trigger to change it
> on the
> way in and avoid code in client applications. The reason for this is
> there
> are
> many client application which will be doing these inserts.

In that case I would recommend either using temp tables to process the
data, or build a middleware app that other client apps would connect
to, rather than to the db directly, the goal being to have a single API
against which you can code the client apps.

Good luck!

Michael Glaesemann
grzm myrealbox com

Browse pgsql-sql by date

  From Date Subject
Next Message Doug McNaught 2004-09-11 13:55:42 Re: PL/pgSQL Function Problem
Previous Message Tom Lane 2004-09-11 06:42:23 Re: CREATE RULE ignored, what did I do wrong