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

Bug in org.postgresql.jdbc2.AbstractJdbc2ResultSet?

From: David Clark <davidclark(at)tx(dot)rr(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Bug in org.postgresql.jdbc2.AbstractJdbc2ResultSet?
Date: 2007-04-30 21:45:37
Message-ID: 200704301645.37898.davidclark@tx.rr.com (view raw or flat)
Thread:
Lists: pgsql-jdbc
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.

Patch:

--- AbstractJdbc2ResultSet.java 2007-04-16 11:37:04.000000000 -0500
+++ AbstractJdbc2ResultSet.java.patched 2007-04-30 15:52:51.000000000 -0500
@@ -117,6 +117,7 @@
             return getBoolean(columnIndex) ? Boolean.TRUE : Boolean.FALSE;
         case Types.TINYINT:
         case Types.SMALLINT:
+           return new Short(getShort(columnIndex));
         case Types.INTEGER:
             return new Integer(getInt(columnIndex));
         case Types.BIGINT:

David Clark

Responses

pgsql-jdbc by date

Next:From: Kris JurkaDate: 2007-04-30 22:34:27
Subject: Re: Bug in org.postgresql.jdbc2.AbstractJdbc2ResultSet?
Previous:From: Dave CramerDate: 2007-04-27 18:50:21
Subject: Re: Refcursor bug

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