Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id A2B29B5DC23 for ; Mon, 31 Oct 2011 07:45:54 -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 12821-09 for ; Mon, 31 Oct 2011 10:45:48 +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 F0993B5DC2A for ; Mon, 31 Oct 2011 07:45:47 -0300 (ADT) Received: by faan17 with SMTP id n17so5369452faa.19 for ; Mon, 31 Oct 2011 03:45:47 -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=f+xkVmIMkdmQ/YIEePQ8mcty284Itv/jeEX06hVEKXY=; b=cMTUSVOnlHSqCnjAahMVYG14N//D470wtrnHOFpW+xRpZaBNBBXEdN322bSpvFAs7N lALewE4wWuk3bBJ0J8ARkH9I+lO0+tWhAwtkBzhWJtv8qS0eYUKrwMK/7+BISesUGb40 yZSGEwUgBsk8fDjacK3bdJdQbJWlHuWjqk0MQ= Received: by 10.223.7.14 with SMTP id b14mr29227961fab.10.1320057947488; Mon, 31 Oct 2011 03:45:47 -0700 (PDT) Received: from [1.0.0.7] ([94.138.24.208]) by mx.google.com with ESMTPS id d21sm34336646fac.4.2011.10.31.03.45.45 (version=SSLv3 cipher=OTHER); Mon, 31 Oct 2011 03:45:46 -0700 (PDT) Message-ID: <4EAE7C58.1070404@gmail.com> Date: Mon, 31 Oct 2011 14:45:44 +0400 From: Alexander LAW 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> <4EACC8AF.2000708@gmail.com> <25672.1320001774@sss.pgh.pa.us> In-Reply-To: <25672.1320001774@sss.pgh.pa.us> Content-Type: text/plain; charset=windows-1251; format=flowed Content-Transfer-Encoding: 8bit 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/308 X-Sequence-Number: 31578 Thank you, Tom. I tried patched file and it works fine now (with Russian locale both in Linux and Windows). I've noticed that you strict mon_decimal_point to one char, but at least two locales (fa_IR and ps_AF) (I looked at glibc-2.14) define mon_decimal_point as "" so it takes two bytes. And IMHO the locale sanity check better move to PGLC_localeconv and don't perform these checks with each number conversion. Best regards, Alexander. 30.10.2011 23:09, Tom Lane пишет: > Alexander Lakhin writes: >> 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. > I've committed a patch that improves the handling of cs_precedes, > sign_posn et al. I don't agree with your proposal to slavishly follow > the locale definition no matter how brain-dead it is, because that would > destroy the ability to dump and reload data without data loss --- for > example, if we obeyed an empty negative_sign setting, we'd lose the > information that a value had been negative. AFAICT there are no such > locales anyway, other than POSIX for which we definitely don't want to > believe the empty-string setting. > > regards, tom lane