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

Re: Bug in org.postgresql.jdbc2.AbstractJdbc2ResultSet?

From: Kris Jurka <books(at)ejurka(dot)com>
To: David Clark <davidclark(at)tx(dot)rr(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Bug in org.postgresql.jdbc2.AbstractJdbc2ResultSet?
Date: 2007-04-30 22:34:27
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-jdbc

On Mon, 30 Apr 2007, David Clark wrote:

> There seems to be a bug in internalGetObject(int, Field) in
> org.postgresql.jdbc2.AbstractJdbc2ResultSet.  I am using the
> postgresql-jdbc-8.0-319.src sources.  I am placing the patch file inline
> below in case the mailing list does not accept attachments.  The bug (?) is
> that for TINYINT and SMALLINT columns a java.lang.Short should be returned
> from internalGetObject, but an Integer is returned instead.

Actually this behavior is correct according to the JDBC spec.  If you see 
Appendix B [1] it says:

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.

Kris Jurka

In response to

pgsql-jdbc by date

Next:From: Chris StuhrDate: 2007-05-01 01:34:56
Subject: Null bind variable in where clause
Previous:From: David ClarkDate: 2007-04-30 21:45:37
Subject: Bug in org.postgresql.jdbc2.AbstractJdbc2ResultSet?

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