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

From: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
To: "Saneesh Apte" <san(at)calccit(dot)org>,<pgsql-bugs(at)postgresql(dot)org>
Subject: Re: JDBC: 2 bugs: Getting a smallint array actually gets an integer array and return type of a boolean array is bit.
Date: 2010-06-29 14:03:57
Message-ID: 4C29B6FD0200002500032CBC@gw.wicourts.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-jdbc

Saneesh Apte <san(at)calccit(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2010-06-29 15:32:45 Re: Function works in 8.4 but not in 9.0 beta2 "ERROR: structure of query does not match function result type"
Previous Message Marcel Asio 2010-06-29 09:03:13 Function works in 8.4 but not in 9.0 beta2 "ERROR: structure of query does not match function result type"

Browse pgsql-jdbc by date

  From Date Subject
Next Message Kris Jurka 2010-06-29 16:50:48 Re: Source code for postgress 7.4?
Previous Message Andrés Maneiro 2010-06-29 07:59:18 Re: Source code for postgress 7.4?