Hi,
I have uncovered what seems to be a bug in the column metadata returned
by the JDBC driver.
If I have a table with a column that a numeric datatype (any
precision/scale) and retrieve the column metadata through
DatabaseMetaData.getColumns() it reports the precision as -1 rather than
the correct precision. Note that the character octet length is also
-1. It seems to return a -1 regardless of the precision/scale of the
numeric datatype.
Now, if I query the table and look at the column metadata through
ResultSet.getMetaData().getPrecision() the correct precision is
returned. So the correct precision is there, it just doesn't work
through DatabaseMetaData.
I am using the JDBC driver that is reported as verison 7.2 and have
tried connecting to a 7.2.1 running on Win2K as well as a 7.2.2 running
on Solaris with the same results.
I dug around the code a little bit and it seems that the JDBC driver is
simply reporting what is in the database table pg_attribute column
attlen. I haven't figured out where the
ResultSet.getMetaData().getPrecision() is getting the correct value from
though.
This problem can be observed with a simple test program (I can provide
one if needed) or by using something like the JDBCTest tool.
Is this a known problem? If so, has it already been fixed?
Thanks,
Kevin