Bug while retrieving money data type from db

From: Andrea Aime <aaime(at)openplans(dot)org>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Bug while retrieving money data type from db
Date: 2008-02-26 13:36:07
Message-ID: 47C415C7.6070200@openplans.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Hi,
I've stumbled into a bug, it seems the driver is not able to
retrive money data type from the db properly unless a getString
is used.... unfortunately in my case the code does not know
what kind of attributes is reading, and it uses getObject instead,
getting back an exception.

Running the attached code all I get is:

Exception in thread "main" org.postgresql.util.PSQLException: Il valore
«1,000.00» non è adeguato al tipo «double».
at
org.postgresql.jdbc2.AbstractJdbc2ResultSet.toDouble(AbstractJdbc2ResultSet.java:2645)
at
org.postgresql.jdbc2.AbstractJdbc2ResultSet.getDouble(AbstractJdbc2ResultSet.java:2032)
at
org.postgresql.jdbc2.AbstractJdbc2ResultSet.internalGetObject(AbstractJdbc2ResultSet.java:134)
at
org.postgresql.jdbc3.AbstractJdbc3ResultSet.internalGetObject(AbstractJdbc3ResultSet.java:39)
at
org.postgresql.jdbc2.AbstractJdbc2ResultSet.getObject(AbstractJdbc2ResultSet.java:2348)
at PgMoneyIssue.main(PgMoneyIssue.java:15)

(translated from italian, "the value 1,000.00 is not adequate for the
type double". Not sure if the problem is locale dependent, since it has
been reported as a GeoServer bug by a user living in USA, and I then
tracked it down to this issue with the driver).

I looked for a bug tracker but could not find one, so here I am, posting
the bug report to the ml.

Contact me back if you need any further information
Cheers
Andrea

Attachment Content-Type Size
PgMoneyIssue.java text/plain 996 bytes

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Daniel Migowski 2008-02-26 13:36:56 Fastest way to check aliveness of connection
Previous Message Bernhard Rosenkränzer 2008-02-26 12:43:39 [PATCH] Make postgresql-jdbc compile with jdk7