From: Mikko Tiihonen <mikko.tiihonen@nitorcreations.com>
To: pgsql-jdbc@postgresql.org
Subject: Re: Bug when retrieving money datatype.
Date: Wed, 30 Nov 2011 08:55:37 +0200
Message-ID: <4ED5D369.30902@nitorcreations.com> (raw)
In-Reply-To: <CA+0W9LOVh4JK1OLYqymtUFJ7Dxa5UTQv_v4g6-gswud12MrvAA@mail.gmail.com>
References: <jb3j7b$s3p$1@dough.gmane.org>
<CA+0W9LOVh4JK1OLYqymtUFJ7Dxa5UTQv_v4g6-gswud12MrvAA@mail.gmail.com>
On 11/29/2011 11:51 PM, Oliver Jowett wrote:
> On 30 November 2011 10:36, Thomas Kellerer<spam_eater@gmx.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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: mikko.tiihonen@nitorcreations.com
Subject: Re: Bug when retrieving money datatype.
In-Reply-To: <4ED5D369.30902@nitorcreations.com>
References: <jb3j7b$s3p$1@dough.gmane.org> <CA+0W9LOVh4JK1OLYqymtUFJ7Dxa5UTQv_v4g6-gswud12MrvAA@mail.gmail.com> <4ED5D369.30902@nitorcreations.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox