Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id 5EA7D1ACD457 for ; Wed, 30 Nov 2011 02:55:52 -0400 (AST) Received: from auth-smtp.nebula.fi ([217.30.180.105]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1RVe59-0001IY-2H for pgsql-jdbc@postgresql.org; Wed, 30 Nov 2011 06:55:52 +0000 Received: from quadvadis.localdomain (gw.nitor.fi [83.145.228.24]) (authenticated bits=0) by auth-smtp.nebula.fi (8.13.8/8.13.4) with ESMTP id pAU6tbYX004609 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 30 Nov 2011 08:55:38 +0200 Message-ID: <4ED5D369.30902@nitorcreations.com> Date: Wed, 30 Nov 2011 08:55:37 +0200 From: Mikko Tiihonen User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:8.0) Gecko/20111115 Thunderbird/8.0 MIME-Version: 1.0 To: pgsql-jdbc@postgresql.org Subject: Re: Bug when retrieving money datatype. References: In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: quoted-printable X-MIME-Autoconverted: from 8bit to quoted-printable by auth-smtp.nebula.fi id pAU6tbYX004609 X-Pg-Spam-Score: -2.6 (--) X-Archive-Number: 201111/112 X-Sequence-Number: 22447 On 11/29/2011 11:51 PM, Oliver Jowett wrote: > On 30 November 2011 10:36, Thomas Kellerer wrote: > >> Bad value for type double : =80100,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 $/=80 or whatever currency the user might have - add binary encoding support -Mikko