Correct getScale() behavior?

From: "Dave Dombrosky" <dombrd(at)gmail(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Correct getScale() behavior?
Date: 2008-05-05 20:24:09
Message-ID: dc5d39030805051324j3cb9f4dagc0f6e965b7f9462d@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

I am currently trying to move from the 8.1 JDBC driver to the 8.2
version. In my app, I have some code that checks the scale of a
NUMERIC, and if it is 0, then I convert the value into an Integer.
This code works fine on 8.1 and previous driver versions, but breaks
on 8.2 and 8.3.

I have looked into the driver source, and it seems like a change was
made in the 8.2+ drivers. When getting the result of an aggregate sum
(of NUMERIC(7,2) values) in 8.1 it returns -1 as the scale, but in 8.2
it returns 0. It looks like "-1" is meant to be taken as an undefined
value, which seems to be the correct behavior to me.

Is there a reason this was changed in the 8.2+ drivers or is this a
bug? I just need to find out, so I know whether to get rid of my
Integer-casting code.

-Dave

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Stephen Frost 2008-05-06 14:01:20 JDBC and GSSAPI/Krb5 with uDig
Previous Message Daniel Migowski 2008-05-05 07:10:53 Re: ERROR: insufficient data left in message