Обсуждение: BUG #5197: JDBC: selecting oid results in Exception
The following bug has been logged online: Bug reference: 5197 Logged by: Joseph Shraibman Email address: jks@selectacast.net PostgreSQL version: 8.2.14 Operating system: Linux 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) at org.postgresql.jdbc2.AbstractJdbc2ResultSet.getInt(AbstractJdbc2ResultSet.ja va:1968) at org.postgresql.jdbc2.AbstractJdbc2ResultSet.internalGetObject(AbstractJdbc2R esultSet.java:119) at org.postgresql.jdbc3.AbstractJdbc3ResultSet.internalGetObject(AbstractJdbc3R esultSet.java:39) at org.postgresql.jdbc2.AbstractJdbc2ResultSet.getObject(AbstractJdbc2ResultSet .java:2429) Casting oid to bigint doesn't result in an Exception
On Wed, Nov 18, 2009 at 11:26 PM, Joseph Shraibman <jks@selectacast.net> wr= ote: > > The following bug has been logged online: > > Bug reference: =A0 =A0 =A05197 > Logged by: =A0 =A0 =A0 =A0 =A0Joseph Shraibman > Email address: =A0 =A0 =A0jks@selectacast.net > PostgreSQL version: 8.2.14 > Operating system: =A0 Linux > Description: =A0 =A0 =A0 =A0JDBC: 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 > =A0 =A0 =A0 =A0at > org.postgresql.jdbc2.AbstractJdbc2ResultSet.toInt(AbstractJdbc2ResultSet.= jav > a:2630) > =A0 =A0 =A0 =A0at > org.postgresql.jdbc2.AbstractJdbc2ResultSet.getInt(AbstractJdbc2ResultSet= .ja > va:1968) > =A0 =A0 =A0 =A0at > org.postgresql.jdbc2.AbstractJdbc2ResultSet.internalGetObject(AbstractJdb= c2R > esultSet.java:119) > =A0 =A0 =A0 =A0at > org.postgresql.jdbc3.AbstractJdbc3ResultSet.internalGetObject(AbstractJdb= c3R > esultSet.java:39) > =A0 =A0 =A0 =A0at > org.postgresql.jdbc2.AbstractJdbc2ResultSet.getObject(AbstractJdbc2Result= Set > .java:2429) > > > > > Casting oid to bigint doesn't result in an Exception Thanks for the report. If you don't get a response from anyone on this list, you might want to try the pgsql-jdbc list instead, as many of us here are not familiar with JDBC specifically. ...Robert
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