Skip site navigation (1) Skip section navigation (2)

Re: BUG #2418: number & date & time

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: James <james(at)mercstudio(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #2418: number & date & time
Date: 2006-05-03 00:11:00
Message-ID: 20060503001100.GB31652@wolff.to (view raw or flat)
Thread:
Lists: pgsql-bugs
On Tue, May 02, 2006 at 10:36:52 +0000,
  James <james(at)mercstudio(dot)com> wrote:
> 
> we would like to have convinience data conversion from datatype number of
> value '' as null and datatype date / timestamp / timestampz of value '' as
> null...
> 
> so far, postgresql will reject those value for number and date / time field
> when it's empty string '' (as invalid date value or invalid number value)
> 
> it would be nice to have it auto converted :)

This isn't a bug and you should have asked this question on another list
(sql, general or novice would all be appropiate).
This isn't easy for you to do in Postgres as data validation is done before
before triggers activate.
I can think of a couple of things to do. One would be to change your app or
add a filter so that NULL is sent instead of ''. Another apporach would be
to read in the data as text with a function that converts the string to date
with the special feature of '' being converted to null. Your function should
be able to call the function used to input dates, so you don't need to do
a lot of hard work there. But depending on how you are inputting the data,
it may not be easy to make this fit an existing app.

In response to

pgsql-bugs by date

Next:From: Andy MaleDate: 2006-05-03 08:41:41
Subject: BUG #2419: could not reattach to shared memory
Previous:From: Bruno Wolff IIIDate: 2006-05-03 00:05:00
Subject: Re: BUG #2417: bug for finding string in column

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group