pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
OID Bug in AbstractJdbc2DatabaseMetaData.java
2+ messages / 2 participants
[nested] [flat]

* OID Bug in AbstractJdbc2DatabaseMetaData.java
@ 2007-05-07 11:57 Q <qdolan@gmail.com>
  2007-12-02 06:51 ` Re: OID Bug in AbstractJdbc2DatabaseMetaData.java Kris Jurka <books@ejurka.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Q @ 2007-05-07 11:57 UTC (permalink / raw)
  To: 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@gmail.com
Gold Coast, QLD, Australia
Ph: +61 419 729 806

^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: OID Bug in AbstractJdbc2DatabaseMetaData.java
  2007-05-07 11:57 OID Bug in AbstractJdbc2DatabaseMetaData.java Q <qdolan@gmail.com>
@ 2007-12-02 06:51 ` Kris Jurka <books@ejurka.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Kris Jurka @ 2007-12-02 06:51 UTC (permalink / raw)
  To: Q <qdolan@gmail.com>; +Cc: pgsql-jdbc



On Mon, 7 May 2007, Q wrote:

> 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.
>
> [Retrieve as long and cast to int.]

Based on this I've put a fix into CVS for all the places that retrieve 
oids as integers, so we can work on databases that have high OIDs.

Kris Jurka



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2007-12-02 06:51 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2007-05-07 11:57 OID Bug in AbstractJdbc2DatabaseMetaData.java Q <qdolan@gmail.com>
2007-12-02 06:51 ` Kris Jurka <books@ejurka.com>

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