From: Oliver Jowett <oliver@opencloud.com>
To: Lloyd Parkes <Lloyd.Parkes@ecs.vuw.ac.nz>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Integer is not a subclass of Short
Date: Fri, 30 Jul 2010 11:51:04 +1200
Message-ID: <4C5213E8.5090801@opencloud.com> (raw)
In-Reply-To: <1280446120.8031.14.camel@cafe-de-la-rue.ecs.vuw.ac.nz>
References: <1280446120.8031.14.camel@cafe-de-la-rue.ecs.vuw.ac.nz>
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
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: oliver@opencloud.com, Lloyd.Parkes@ecs.vuw.ac.nz
Subject: Re: Integer is not a subclass of Short
In-Reply-To: <4C5213E8.5090801@opencloud.com>
References: <1280446120.8031.14.camel@cafe-de-la-rue.ecs.vuw.ac.nz> <4C5213E8.5090801@opencloud.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