setBoolean and char/varchar - Mailing list pgsql-jdbc

From Paulo Merson
Subject setBoolean and char/varchar
Date
Msg-id 000d01c19eae$31d14160$c501a8c0@PAULO
Whole thread Raw
List pgsql-jdbc
If you store '0' and '1' in a varchar(1) or char(1) column, you can read
false and true respectively using ResultSet.getBoolean. This is great,
especially if you are migrating from an Oracle database (shamefully
Oracle doesn't have a Boolean data type).

However, if you try to use PreparedStatement.setBoolean to set a value
used in the "where" clause to compare to that '0'-or-'1' varchar(1) or
char(1) column, then your select returns nothing.

Isn't this behavior inconsistent between getBoolean and setBoolean? Is
this a bug?

(Oracle jdbc driver does allow getBoolean and setBoolean with char(1)
and varchar2(1) consistently).

Thanks,

Paulo Merson
Summa Technologies - www.summa-tech.com


pgsql-jdbc by date:

Previous
From: "zhousj"
Date:
Subject: jdbc bug
Next
From: "Vianen, Jeroen van"
Date:
Subject: Re: Problem with getImportedKeys / getExportedKeys