Received: from localhost (maia-2.hub.org [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id 457EB9FB2A3 for ; Mon, 7 May 2007 08:57:58 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-maia, port 10024) with ESMTP id 52004-01 for ; Mon, 7 May 2007 08:57:48 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.4 Received: from py-out-1112.google.com (py-out-1112.google.com [64.233.166.177]) by postgresql.org (Postfix) with ESMTP id BB7A59FB24D for ; Mon, 7 May 2007 08:57:52 -0300 (ADT) Received: by py-out-1112.google.com with SMTP id a73so1199296pye for ; Mon, 07 May 2007 04:57:51 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:mime-version:to:message-id:content-type:from:subject:date:x-mailer; b=XHGXEISKzd7xWzrrP3CdrpkNpHrPr7cfA68HXOeSVa0hmHCJsirg99iqXDD7FUFdPeLDMUO08nlF8UMvEnR2cQy4+hYnliqAU4U9Jl1SVd0rL49IdYN04uHj/b9e/QvIRKSpeaFwSYAuncymt297I86/u5GzCKLKjKZxnMMLOXw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:mime-version:to:message-id:content-type:from:subject:date:x-mailer; b=T8mBfJEqfVum8x+FHILHNgPJ9V4LfWxS4engbhManghwhKKKAnik5xMlBC9iQotsOXJHFOK5yTHqbhxzVjo2wCL5z9SZpzPy4wXZqtfceDdbwMybofpAvrSU4kHt5Q9Ugv7rTtuLzEkA0f1H9WilG6R2qcQJhGIe9cELJP+zuD4= Received: by 10.35.75.1 with SMTP id c1mr11129347pyl.1178539071470; Mon, 07 May 2007 04:57:51 -0700 (PDT) Received: from ?192.168.100.148? ( [203.144.21.67]) by mx.google.com with ESMTP id n63sm15300187pyh.2007.05.07.04.57.48; Mon, 07 May 2007 04:57:50 -0700 (PDT) Mime-Version: 1.0 (Apple Message framework v752.2) To: pgsql-jdbc@postgresql.org Message-Id: <2AC0EF77-E032-4459-A980-DF9E630EF6E1@gmail.com> Content-Type: multipart/alternative; boundary=Apple-Mail-8-515883082 From: Q Subject: OID Bug in AbstractJdbc2DatabaseMetaData.java Date: Mon, 7 May 2007 21:57:42 +1000 X-Mailer: Apple Mail (2.752.2) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200705/23 X-Sequence-Number: 17013 --Apple-Mail-8-515883082 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed 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 --Apple-Mail-8-515883082 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=ISO-8859-1 I recently ran into an issue = upgrading from the 8.1 JDBC driver where the more recent drivers=A0would = throw an exception when=A0retrieving meta data if there were any = relations with very large OID's. (exceeding 2^31).

The=A0following patch = "resolved" things enough to avoid the issue.

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


--

Quinton Dolan - qdolan@gmail.com

Gold Coast, QLD, Australia

Ph: +61 419 729 806


=

= --Apple-Mail-8-515883082--