Re: JDBC: 2 bugs: Getting a smallint array actually gets an integer array and return type of a boolean array is bit. - Mailing list pgsql-bugs

From Kevin Grittner
Subject Re: JDBC: 2 bugs: Getting a smallint array actually gets an integer array and return type of a boolean array is bit.
Date
Msg-id 4C29B6FD0200002500032CBC@gw.wicourts.gov
Whole thread Raw
In response to JDBC: 2 bugs: Getting a smallint array actually gets an integer array and return type of a boolean array is bit.  (Saneesh Apte <san@calccit.org>)
List pgsql-bugs
Saneesh Apte <san@calccit.org> wrote:

> the base type of a boolean[] is java.sql.Types.BIT instead or
> java.sql.Types.BOOLEAN.  At the very least shouldn't these be
> aliases for the same type?
>
> And secondly the returned type from a smallint[] is an Integer[]
> instead of a Short[].

Should the objects in the array returned by getArray be typed
according to the rules of an individual value returned by getObject?
(I couldn't find anything explicit on that, but it seems
reasonable.)  If that *is* true, the controlling part of the spec
is:

http://java.sun.com/javase/6/docs/technotes/guides/jdbc/getstart/mapping.html#table3

That maps SQL types TINYINT, SMALLINT, AND INTEGER to Java Integer.
It also maps SQL BIT to Java Boolean.  The SQL type of BOOLEAN was a
latecomer to the SQL spec, and it appears that JDBC hasn't yet added
it to the mappings.

Do you have a reference to something which indicates that getArray
should use a different mapping?

Maybe someone will see it differently, but I don't think I see a bug
here.  Compliance with the spec is not a bug, even if the spec is a
bit odd....  ;-)

-Kevin

pgsql-bugs by date:

Previous
From: Marcel Asio
Date:
Subject: Function works in 8.4 but not in 9.0 beta2 "ERROR: structure of query does not match function result type"
Next
From: Tom Lane
Date:
Subject: Re: Function works in 8.4 but not in 9.0 beta2 "ERROR: structure of query does not match function result type"