Null vs. Empty String in Postgres 8.3.8

From: "Wang, Mary Y" <mary(dot)y(dot)wang(at)boeing(dot)com>
To: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Null vs. Empty String in Postgres 8.3.8
Date: 2010-04-05 02:35:21
Message-ID: FA20D4C4FEBFD148B1C0CB09913825FC0457D936A9@XCH-SW-06V.sw.nos.boeing.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Can someone provide a link to the Postgres 8.x documentation that provides information about Null vs. Empty String?
Here is the situation:
Currently, the source code performs the following SQL statement :
UPDATE user_group set subversion_flags='' WHERE user_id='5818' AND group_id='438';
(This SQL statement worked in a very old version of Postgres)
and pgsql 8.3.8 returned ERROR: invalid input syntax for integer: ""
The table
\d user_group
Table "public.user_group"
Column | Type | Modifiers
------------------+---------------+-------------------------------------------- ---------------------
user_group_id | integer | not null default nextval(('user_group_pk_se q'::text)::regclass)
user_id | integer | not null default 0
group_id | integer | not null default 0
subversion_flags | integer | not null default 0
.
.

I know probably the best way is to the put check in the application level (making sure that subversion_flags has a value) before the actual update SQL call; however, I really just want to port the code to work with Postgres 8.3.8 avoiding any code changes if that's possible. Is there something that I can do at the database level (like alter the table) so that I can still use the same SQL statement in the application level listed above and it wouldn't return an error? Any ideas?

Thanks in advance
Mary

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2010-04-05 02:49:42 Re: Null vs. Empty String in Postgres 8.3.8
Previous Message Rob Wultsch 2010-04-05 01:58:35 Re: Completely wrong row estimates