Skip site navigation (1) Skip section navigation (2)

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

From: Oliver Jowett <oliver(at)opencloud(dot)com>
To: Saneesh Apte <san(at)calccit(dot)org>
Cc: pgsql-bugs(at)postgresql(dot)org, PostgreSQL - JDBC <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: [JDBC] JDBC: 2 bugs: Getting a smallint array actually gets an integer array and return type of a boolean array is bit.
Date: 2010-06-30 01:10:33
Message-ID: 4C2A9989.2050302@opencloud.com (view raw or flat)
Thread:
Lists: pgsql-bugspgsql-jdbc
Saneesh Apte wrote:

>     I think I found two bugs (and I hope I am not wasting everyone's time).
>     One is minor: 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?

Types.BOOLEAN does not exist before JDBC3. Client code can use either, 
but we have to pick one or the other when returning a value, so we 
return BIT.

>     And secondly the returned type from a smallint[] is an Integer[] 
> instead of a Short[].

smallint is a Types.SMALLINT which is mapped to java.lang.Integer by the 
JDBC spec. See appendix B of the spec:

> Note – The JDBC 1.0 specification defined the Java object mapping for the
> SMALLINT and TINYINT JDBC types to be Integer. The Java language did not
> include the Byte and Short data types when the JDBC 1.0 specification was
> finalized. The mapping of SMALLINT and TINYINT to Integer is maintained to
> preserve backwards compatibility.

-O

In response to

pgsql-bugs by date

Next:From: Ola SergatchovDate: 2010-06-30 01:52:38
Subject: BUG #5531: REGEXP_ REPLACE causes connection drop
Previous:From: Bruce MomjianDate: 2010-06-29 22:24:25
Subject: Re: local_preload_libraries filenames converted to lowercase

pgsql-jdbc by date

Next:From: Thomas KellererDate: 2010-06-30 17:01:19
Subject: 9.0 and pg_stat_activity.application_name
Previous:From: dmpDate: 2010-06-29 19:03:26
Subject: Re: [JDBC] JDBC: 2 bugs: Getting a smallint array actually gets an integer array and return type of a boolean array is bit.

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group