On Fri, Apr 23, 2004 at 11:36:51 +0100,
mike <mike(at)redtux1(dot)uklinux(dot)net> wrote:
> Is it possible to to the following
> I have tables which are updated via webpage (perl) with fields of type
> int and date (all nullable). If the values are blank the entire insert
> fails, with a wrong type error.
> Is there any way to stop this behaviour so that the valid information is
> allowed,but the blank values get ignored.
Ignore? If you want blanks turned into NULLs, probably the best place to
do this is in the application. I can think of three ways to do this:
Use NULLIF to replace the specified input strings into NULLs, while
leaving other strings as is.
Have the appkication detect the strings that should be NULL and replace them
with NULL (which shouldn't be quoted unlike the normal string data).
Split off the two columns that can have null values into their own tables
and only enter records there when the input is nonblank. This is perhaps
the closest to "ignoring" blanks that you can do.
In response to
pgsql-general by date
|Next:||From: Pascal Polleunus||Date: 2004-04-23 14:28:16|
|Subject: Synchronize unicode data using copy or pg_dump|
|Previous:||From: Bruno Wolff III||Date: 2004-04-23 13:56:58|
|Subject: Re: Question about inserts|