Re: [GENERAL] Converting empty input strings to Nulls

2008-05-31 Thread Martin
ject: [GENERAL] Converting empty input strings to Nulls Applications accessing my PostgreSQL 8.0 database like to submit no-value date column values as empty strings rather than as Nulls. This, of course, causes this PG error: SQL State: 22007 ERROR: invalid input syntax for type date: "&

Re: [GENERAL] Converting empty input strings to Nulls

2008-05-31 Thread Jeff Davis
On Sat, 2008-05-31 at 13:40 -0400, Ken Winter wrote: > I'm looking for a way to trap this bad input at the database level, quietly > convert the input empty strings to Null, and store the Null in the date > column. I tried a BEFORE INSERT OR UPDATE trigger evoking this function ... You can replac

Re: [GENERAL] Converting empty input strings to Nulls

2008-05-31 Thread Craig Ringer
Pavel Stehule wrote: > Hello > > 2008/5/31 Ken Winter <[EMAIL PROTECTED]>: >> ... but an empty string still evokes the error even before this function is >> triggered. >> >> Is there a way to convert empty strings to Nulls before the error is evoked? >> > no - it's not possible. And some "magic" f

Re: [GENERAL] Converting empty input strings to Nulls

2008-05-31 Thread Pavel Stehule
Hello 2008/5/31 Ken Winter <[EMAIL PROTECTED]>: > Applications accessing my PostgreSQL 8.0 database like to submit no-value > date column values as empty strings rather than as Nulls. This, of course, > causes this PG error: > > SQL State: 22007 > ERROR: invalid input syntax for type date: "" > >

[GENERAL] Converting empty input strings to Nulls

2008-05-31 Thread Ken Winter
Applications accessing my PostgreSQL 8.0 database like to submit no-value date column values as empty strings rather than as Nulls. This, of course, causes this PG error: SQL State: 22007 ERROR: invalid input syntax for type date: "" I'm looking for a way to trap this bad input at the database l