Hi guys,
Dave tells me this has been discussed recently, but doesn't recall the
thread, so I'll post here.
In postgresql-8.0-311.jdbc3.jar with a column defined as smallint, the
corresponding value returned from getObject() is a Short.
In the current HEAD, that same smallint column is returned as an Integer.
This causes HUGE problems if it's not an oversight, as it makes it
virtually impossible to write JDBC code that works with other dbs
(which typically return Short).
From the JDK 1.5 docs (and all the previous ones as well):
http://java.sun.com/j2se/1.5.0/docs/guide/jdbc/getstart/mapping.html
---------------------------------
8.3.5 SMALLINT
The JDBC type SMALLINT represents a 16-bit signed integer value
between -32768 and 32767.
The corresponding SQL type, SMALLINT, is defined in SQL-92 and is
supported by all the major databases. The SQL-92 standard leaves the
precision of SMALLINT up to the implementation, but in practice, all
the major databases support at least 16 bits.
The recommended Java mapping for the JDBC SMALLINT type is as a Java short.
---------------------------------
Can someone confirm that this is a bug, and if not, a) why (given the
above documentation), and b) how do you expect to deal with the
incompatibility issues this would cause?
Thanks,
Christian