Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UbuAv-0007jE-04 for pgsql-bugs@arkaria.postgresql.org; Mon, 13 May 2013 14:56:29 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1UbuAu-00070B-Df for pgsql-bugs@arkaria.postgresql.org; Mon, 13 May 2013 14:56:28 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UbuAt-000705-I4 for pgsql-bugs@postgresql.org; Mon, 13 May 2013 14:56:27 +0000 Received: from smtp-outbound-2.vmware.com ([208.91.2.13]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UbuAo-0000lV-2M for pgsql-bugs@postgresql.org; Mon, 13 May 2013 14:56:27 +0000 Received: from sc9-mailhost1.vmware.com (sc9-mailhost1.vmware.com [10.113.161.71]) by smtp-outbound-2.vmware.com (Postfix) with ESMTP id 1376428164; Mon, 13 May 2013 07:56:19 -0700 (PDT) Received: from zcs-prod-ext-mta-1.vmware.com (zcs-prod-ext-mta-1.vmware.com [10.113.62.223]) by sc9-mailhost1.vmware.com (Postfix) with ESMTP id 10A56180A9; Mon, 13 May 2013 07:56:19 -0700 (PDT) Received: from zcs-prod-ext-mta-1.vmware.com (localhost.localdomain [127.0.0.1]) by zcs-prod-ext-mta-1.vmware.com (Postfix) with ESMTP id D3521120039; Mon, 13 May 2013 08:01:28 -0700 (PDT) Received: from [192.168.1.90] (zimbra-prod-ext-proxy-vip.vmware.com [10.113.63.87]) by zcs-prod-ext-mta-1.vmware.com (Postfix) with ESMTPSA; Mon, 13 May 2013 08:01:27 -0700 (PDT) Message-ID: <5190FF0E.4020602@vmware.com> Date: Mon, 13 May 2013 17:56:14 +0300 From: Heikki Linnakangas Organization: VMware User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.12) Gecko/20130116 Icedove/10.0.12 MIME-Version: 1.0 To: Tom Lane CC: Euler Taveira , Thomas Kellerer , pgsql-bugs@postgresql.org Subject: Re: Inconsistency between TO_CHAR() and TO_NUMBER() References: <51878292.6080003@fooby.de> <14272.1367850378@sss.pgh.pa.us> <5187C2FE.9000305@fooby.de> <8415.1368200958@sss.pgh.pa.us> <518D71FB.9050106@timbira.com.br> <5190C442.3000609@vmware.com> <2768.1368454158@sss.pgh.pa.us> In-Reply-To: <2768.1368454158@sss.pgh.pa.us> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -7.5 (-------) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org On 13.05.2013 17:09, Tom Lane wrote: > Heikki Linnakangas writes: >> Would it be possible to be lenient, and also accept . as the decimal >> separator, when there is no ambiguity? Ie. when . is not the thousands >> separator. > > I originally coded it that way, but concluded that it was probably a > waste of code space. How many locales can you point to where neither > the decimal point nor thousands_sep is "."? On my laptop, there are eight locales that use "," as the decimal separator and " " as the thousands separator. $ grep -l "^thousands_sep.*U00A0" /usr/share/i18n/locales/* | xargs grep -l "^decimal_point.*U002C" /usr/share/i18n/locales/cs_CZ /usr/share/i18n/locales/et_EE /usr/share/i18n/locales/fi_FI /usr/share/i18n/locales/lv_LV /usr/share/i18n/locales/nb_NO /usr/share/i18n/locales/ru_RU /usr/share/i18n/locales/sk_SK /usr/share/i18n/locales/uk_UA Out of these, ru_RU actually uses "." as the LC_MONETARY decimal point, even though it uses "," as the LC_NUMERIC decimal point. I think that strengthens the argument for accepting both. I don't speak Russian, but if you pass a monetary value to TO_NUMBER in ru_RU locale, using "." as the decimal separator, you probably would expect it to work. According to http://en.wikipedia.org/wiki/Decimal_separator#Examples_of_use, many countries accept either "1 234 567,89" or "1.234.567,89" style, but looking at the locale files installed on my system, the latter style is the one actually used (e.g Germany). - Heikki -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs