Re: BUG #1712: JDBC column precision for bigint is 0

From: Oliver Jowett <oliver(at)opencloud(dot)com>
To: Gilles Dubochet <dubochet(at)urbanet(dot)ch>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #1712: JDBC column precision for bigint is 0
Date: 2005-06-13 21:57:01
Message-ID: 42AE012D.9000600@opencloud.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Gilles Dubochet wrote:
>>> Whith the JDBC driver at least up to version 8.1dev-400, the result
>>> of the
>>> getPrecision method of ResultSetMetaData on a bigint column is 0
>>> instead of
>>> the expected 19.
>>>
>>
>> This has been reported before but I haven't got to fixing it yet. This
>> is partly because I haven't seen a good explanation of exactly what we
>> should be returning here -- what spec says we should return 19?

> If you count the number of digits in these numbers, you'll notice that
> for the signed number, 19 decimal digits at most are required to
> represent it (if the sign comes for free, which seems assumed for other
> data types such as INT or SMALLINT). [...]

> This is why I believe 19 is the value the getPrecision method should
> return. I don't think there is some kind of standard reference that
> defines it, but it seems pretty clear what it should be really.

The problem I have is how we decide that "precision" means "number of
digits, ignoring sign".

Actually, I just dug through the JDBC javadoc, and noticed that
ResultSetMetaData.getPrecision() does talk about the number of decimal
digits; but in all the other places it's used (such as DatabaseMetaData)
it's not described.

For numeric types using number of decimal digits seems reasonable since
it's consistent with the NUMERIC type's precision/scale information.

Previous reports of this also wanted to provide precision for dates and
times according to the number of digits in them, which seems much more
dubious.

I guess it's another case of the JDBC specification being woefully
underspecified :(

-O

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Klint Gore 2005-06-14 01:53:58 Re: BUG #1698: Different behavior in UNIQUE and DISTINCT
Previous Message Kevin Grittner 2005-06-13 15:39:51 Re: BUG #1712: JDBC column precision for bigint is 0