Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id B0429B5DC27 for ; Sat, 29 Oct 2011 13:17:27 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 59357-05 for ; Sat, 29 Oct 2011 16:17:17 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.8.0-rc2 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id 57D68B5DBF0 for ; Sat, 29 Oct 2011 13:17:17 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id p9TGHFTh016310; Sat, 29 Oct 2011 12:17:15 -0400 (EDT) To: "Alexander LAW" cc: pgsql-bugs@postgresql.org Subject: Re: BUG #6277: Money datatype conversion wrong with Russian locale In-reply-to: <201110291210.p9TCAHBA041757@wwwmaster.postgresql.org> References: <201110291210.p9TCAHBA041757@wwwmaster.postgresql.org> Comments: In-reply-to "Alexander LAW" message dated "Sat, 29 Oct 2011 12:10:17 +0000" Date: Sat, 29 Oct 2011 12:17:15 -0400 Message-ID: <16309.1319905035@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.404 tagged_above=-5 required=5 tests=BAYES_00=-1.9, RP_MATCHES_RCVD=-0.504 X-Spam-Level: X-Archive-Number: 201110/298 X-Sequence-Number: 31568 "Alexander LAW" 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