Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 2D97A6322DA for ; Thu, 29 Jul 2010 20:51:25 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 99856-02 for ; Thu, 29 Jul 2010 23:51:13 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from tremor.opencloud.co.nz (tremor.opencloud.co.nz [131.203.101.230]) by mail.postgresql.org (Postfix) with ESMTP id A3F09633229 for ; Thu, 29 Jul 2010 20:51:13 -0300 (ADT) Received: from 121-98-80-66.bitstream.orcon.net.nz ([121.98.80.66] helo=[192.168.1.2]) by tremor.opencloud.co.nz with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1OecsX-0007Dz-6T; Fri, 30 Jul 2010 11:51:09 +1200 Message-ID: <4C5213E8.5090801@opencloud.com> Date: Fri, 30 Jul 2010 11:51:04 +1200 From: Oliver Jowett User-Agent: Thunderbird 2.0.0.24 (X11/20100411) MIME-Version: 1.0 To: Lloyd Parkes CC: pgsql-jdbc@postgresql.org Subject: Re: Integer is not a subclass of Short References: <1280446120.8031.14.camel@cafe-de-la-rue.ecs.vuw.ac.nz> In-Reply-To: <1280446120.8031.14.camel@cafe-de-la-rue.ecs.vuw.ac.nz> X-Enigmail-Version: 0.95.7 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-0.001 tagged_above=-10 required=5 tests=BAYES_20=-0.001 X-Spam-Level: X-Archive-Number: 201007/133 X-Sequence-Number: 20798 Lloyd Parkes wrote: > Hi all, > I have found a problem with a discrepancy between getColumnClassName() > in jdbc/pgjdbc/org/postgresql/jdbc2/AbstractJdbc2ResultSetMetaData.java > and internalGetObject() in > jdbc/pgjdbc/org/postgresql/jdbc2/AbstractJdbc2ResultSet.java. > > The former is defined (indirectly) to return the fully qualified class > name of (a possible superclass of) the object returned by the latter. > For a smallint column, the former returns "java.lang.Short", but the > latter returns a java.lang.Integer. Short is neither Integer, nor a > superclass of Integer. > > I guess someone should add the line "return new > Short(getShort(columnIndex));" between lines 123 and 124 of rev 1.108 of > AbstractJdbc2ResultSet.java. There may be a similar problem with tinyint > columns, but I don't have any tinyint columns. getObject() on a smallint column is correct to return an Integer (see table B-3 in the JDBC spec), so if the metadata method is claiming it should be a Short, then it's the metadata method that's wrong. That said, I think you must be using a very old driver. The last time I can see TypeInfoCache mapping int2 to "java.lang.Short" is back in the 8.1 driver branch. 8.2 and later should return "java.lang.Integer". -O