pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Q <qdolan@gmail.com>
To: pgsql-jdbc@postgresql.org
Subject: OID Bug in AbstractJdbc2DatabaseMetaData.java
Date: Mon, 7 May 2007 21:57:42 +1000
Message-ID: <2AC0EF77-E032-4459-A980-DF9E630EF6E1@gmail.com> (raw)

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@gmail.com
Gold Coast, QLD, Australia
Ph: +61 419 729 806

view thread (2+ messages)  latest in thread

Message-ID: <2AC0EF77-E032-4459-A980-DF9E630EF6E1@gmail.com>
Permalink:  ../2AC0EF77-E032-4459-A980-DF9E630EF6E1@gmail.com/
Also on:    postgresql.org/message-id/2AC0EF77-E032-4459-A980-DF9E630EF6E1@gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: qdolan@gmail.com
  Subject: Re: OID Bug in AbstractJdbc2DatabaseMetaData.java
  In-Reply-To: <2AC0EF77-E032-4459-A980-DF9E630EF6E1@gmail.com>
  References: <2AC0EF77-E032-4459-A980-DF9E630EF6E1@gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox