JDBC MetaData Problem

From: Kevin Schmidt <kevin(dot)schmidt(at)enterworks(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: JDBC MetaData Problem
Date: 2002-10-10 16:47:31
Message-ID: 3DA5AF23.831AB073@enterworks.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

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

Browse pgsql-jdbc by date

  From Date Subject
Next Message Barry Lind 2002-10-10 17:08:33 Re: Getting a ResultSet for a refcursor element.
Previous Message Barry Lind 2002-10-10 16:40:19 Re: Out of memory error on huge resultset