From: Alexander Lakhin <exclusion@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #6277: Money datatype conversion wrong with Russian locale
Date: Sun, 30 Oct 2011 07:46:55 +0400
Message-ID: <4EACC8AF.2000708@gmail.com> (raw)
In-Reply-To: <16309.1319905035@sss.pgh.pa.us>
References: <201110291210.p9TCAHBA041757@wwwmaster.postgresql.org>
<16309.1319905035@sss.pgh.pa.us>
I think there is no need to leave such assumptions. I would propose the
following fix: http://pastebin.com/EBw5YB65 (it corrects a BUG #6144 too)
I can send it as a patch if you wish. Please notice a comments regarding
regression tests. IMHO at least currency symbol separator should be
processed as specified in lconv. And maybe mon_decimal_point,
currency_symbol and negative_sign should be allowed to be empty too if
it's defined by a locale.
Best regards,
Alexander
29.10.2011 20:17, Tom Lane writes:
> "Alexander LAW"<exclusion@gmail.com> writes:
>> It's caused by wrong mon_thousands_sep processing in
>> backend/utils/adt/cash.c, cash_out function.
>> The code assumes that the thousands separator fits in one character. But in
>> Russian locale we have non-breakable space as the thousands separator (0xC2
>> 0xA0 in UTF-8).
> Hmm ... looks like cash_out really needs a significant rewrite to make
> that work nicely. It's combining counting of digit positions with
> counting of output bytes, which was messy enough already, but gets
> worse fast if the thousands separator isn't a single byte.
>
> Does anyone know of locales where the decimal point isn't a single byte?
> I'm wondering if that assumption needs to be got rid of too.
>
> regards, tom lane
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-bugs@postgresql.org
Cc: exclusion@gmail.com, tgl@sss.pgh.pa.us
Subject: Re: BUG #6277: Money datatype conversion wrong with Russian locale
In-Reply-To: <4EACC8AF.2000708@gmail.com>
References: <201110291210.p9TCAHBA041757@wwwmaster.postgresql.org> <16309.1319905035@sss.pgh.pa.us> <4EACC8AF.2000708@gmail.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