OID Bug in AbstractJdbc2DatabaseMetaData.java

From: Q <qdolan(at)gmail(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: OID Bug in AbstractJdbc2DatabaseMetaData.java
Date: 2007-05-07 11:57:42
Message-ID: 2AC0EF77-E032-4459-A980-DF9E630EF6E1@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

I recently ran into an issue upgrading from the 8.1 JDBC driver where
the more recent drivers would throw an exception when retrieving meta
data if there were any relations with very large OID's. (exceeding
2^31).

The following patch "resolved" things enough to avoid the issue.

--- org/postgresql/jdbc2/
AbstractJdbc2DatabaseMetaData.java.orig Thu Apr 26 10:42:27 2007
+++ org/postgresql/jdbc2/AbstractJdbc2DatabaseMetaData.java Thu
Apr 26 10:52:45 2007
@@ -3564,7 +3564,7 @@
{
byte[][] tuple = new byte[18][];
String typname = rs.getString(1);
- int typeOid = rs.getInt(2);
+ int typeOid = (int)rs.getLong(2) & 0xffffffff;
tuple[0] = connection.encodeString(typname);
tuple[1] = connection.encodeString(Integer.toString
(connection.getSQLType(typname)));

--
Seeya...Q

Quinton Dolan - qdolan(at)gmail(dot)com
Gold Coast, QLD, Australia
Ph: +61 419 729 806

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Dave Cramer 2007-05-07 12:39:40 Re: Problem with Utilizing executeBatch() with stored procedures
Previous Message Kranti Parisa 2007-05-07 11:46:34 Re: Problem with Utilizing executeBatch() with stored procedures