Re: BUG #5197: JDBC: selecting oid results in Exception

Kris Jurka <books@ejurka.com>

From: Kris Jurka <books@ejurka.com>
To: Joseph Shraibman <jks@selectacast.net>
Cc: pgsql-bugs@postgresql.org
Date: 2009-11-20T23:43:04Z
Lists: pgsql-bugs

On Thu, 19 Nov 2009, Joseph Shraibman wrote:

>
> The following bug has been logged online:
>
> Bug reference:      5197
> Description:        JDBC: selecting oid results in Exception
> Details:
>
> query: "select oid FROM pg_catalog.pg_class c;"
>
> -----------------------------------------------
> org.postgresql.util.PSQLException: Bad value for type int : 2148618421
> 	at
> org.postgresql.jdbc2.AbstractJdbc2ResultSet.toInt(AbstractJdbc2ResultSet.jav
> a:2630)

Java doesn't have an equivalent for unsigned types, so the JDBC driver 
internally tries to fit it into a signed int by using the negative values. 
Unfortunately that's failing and it's not what the user wants for this 
case.  I imagine the user really wants to get a Long back from this.  I'm 
going on vacation next week, but when I return, I'll make that happen.

Kris Jurka