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

Possible to insert quoted null value into integer field?

From: pablo_tweek(at)yahoo(dot)com (Pablo S)
To: pgsql-general(at)postgresql(dot)org
Subject: Possible to insert quoted null value into integer field?
Date: 2004-08-24 04:13:34
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-general
Hi all, I have search high and low on this - 

Take for instance the statement : 

insert into foo (text1, text2, int1) values ('Foo', 'Bar', '');

On Pg 7.2.x, the db would happily insert the null val into the int
field.  HOWSOMEVER, 7.4.x will explode and error back with:

"DBD::Pg::st execute failed: ERROR: invalid input syntax for integer:
"" at /cgi-bin/foo line xxx"

I see what it is complaining about but I am wondering if there is any
way to roll back this feature, as I have this cheesy bit of perl that
dynamically builds the query and quotes everything and I don't want to
have to change all occurrences to insert the NULL or worse yet try to
differentiate between int/string.

Many thanks,



pgsql-general by date

Next:From: David WheelerDate: 2004-08-24 04:20:36
Subject: Re: UTF-8 and LIKE vs =
Previous:From: Michael FuhrDate: 2004-08-24 04:07:35
Subject: Re: Python and 8.0 beta

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