Correct getScale() behavior? - Mailing list pgsql-jdbc

From Dave Dombrosky
Subject Correct getScale() behavior?
Date
Msg-id dc5d39030805051324j3cb9f4dagc0f6e965b7f9462d@mail.gmail.com
Whole thread Raw
Responses Re: Correct getScale() behavior?
List 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

pgsql-jdbc by date:

Previous
From: Daniel Migowski
Date:
Subject: Re: ERROR: insufficient data left in message
Next
From: Stephen Frost
Date:
Subject: JDBC and GSSAPI/Krb5 with uDig