Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 6D8EEB5DC2B for ; Sun, 30 Oct 2011 00:47:05 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 55500-04 for ; Sun, 30 Oct 2011 03:46:59 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0-rc2 Received: from mail-fx0-f46.google.com (mail-fx0-f46.google.com [209.85.161.46]) by mail.postgresql.org (Postfix) with ESMTP id AA4CBB5D91F for ; Sun, 30 Oct 2011 00:46:58 -0300 (ADT) Received: by faan17 with SMTP id n17so4651693faa.19 for ; Sat, 29 Oct 2011 20:46:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=riO3yW+bRTIzNJWbhX0OUHK1tZy6tPMjutzUCl8nsGk=; b=tpu9VYTPn3rvkURTa0gUxQRpHL1HD5RID0OLwOLdDLG6gLZCq5p7SZmRgOgEIs4GrY mJSqiOBmyugYRk3DkiEvEjF7gTUUgQjWL+Rvz+wMkEjL2MbH4m7cggLvKrSw8VmrJeWF onO37suizsK/QqhthIArGAftK9cHZld3xVHeg= Received: by 10.223.75.15 with SMTP id w15mr18639298faj.9.1319946417599; Sat, 29 Oct 2011 20:46:57 -0700 (PDT) Received: from [1.0.0.7] ([94.138.24.208]) by mx.google.com with ESMTPS id c13sm28552664fai.3.2011.10.29.20.46.55 (version=SSLv3 cipher=OTHER); Sat, 29 Oct 2011 20:46:56 -0700 (PDT) Message-ID: <4EACC8AF.2000708@gmail.com> Date: Sun, 30 Oct 2011 07:46:55 +0400 From: Alexander Lakhin User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:7.0.1) Gecko/20110929 Thunderbird/7.0.1 MIME-Version: 1.0 To: Tom Lane CC: pgsql-bugs@postgresql.org Subject: Re: BUG #6277: Money datatype conversion wrong with Russian locale References: <201110291210.p9TCAHBA041757@wwwmaster.postgresql.org> <16309.1319905035@sss.pgh.pa.us> In-Reply-To: <16309.1319905035@sss.pgh.pa.us> Content-Type: text/plain; charset=windows-1251; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.899 tagged_above=-5 required=5 tests=BAYES_00=-1.9, FREEMAIL_FROM=0.001 X-Spam-Level: X-Archive-Number: 201110/299 X-Sequence-Number: 31569 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" 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