Re: Bug when retrieving money datatype.

From: Mikko Tiihonen <mikko(dot)tiihonen(at)nitorcreations(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Bug when retrieving money datatype.
Date: 2011-11-30 06:55:37
Message-ID: 4ED5D369.30902@nitorcreations.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

On 11/29/2011 11:51 PM, Oliver Jowett wrote:
> On 30 November 2011 10:36, Thomas Kellerer<spam_eater(at)gmx(dot)net> wrote:
>
>> Bad value for type double : €100,00
>
> Looks like an internationalization problem - the code that handles
> parsing money values isn't expecting a euro sign, just a dollar sign.
> Is there a standard way to correctly interpret money values formatted
> by the server when the client's locale might be different to the
> server's?

I was planning to add the binary format support for money to the
jdbc driver when I had some free time. It will solve all parsing
problems related to locale and give nice speed boost at the same time.

The current way is a hack where the generic number parsing knows how to
ignore $ and (). Of course we should also fix the text format parsing.

In both cases I think the correct way is to handle the money as a
PGmoney type in jdbc driver.

Here is my mental list of what should be improved around the PGmoney:
- Use BigDecimal instead of double
- Support sending the text format in the server locale
- Proper conversion when requested with getBigDecimal, getDouble,
getInt, getLong in the driver
- Making sure getString of money type will no longer return the $/€ or
whatever currency the user might have
- add binary encoding support

-Mikko

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Oliver Jowett 2011-11-30 07:01:52 Re: Bug: Cannot pass null in Parameter in Query for ISNULL
Previous Message bht 2011-11-30 06:51:59 Bug: Cannot pass null in Parameter in Query for ISNULL