pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Heikki Linnakangas <hlinnakangas@vmware.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Euler Taveira <euler@timbira.com.br>
Cc: Thomas Kellerer <spam_eater@gmx.net>
Cc: pgsql-bugs@postgresql.org
Subject: Re: Inconsistency between TO_CHAR() and TO_NUMBER()
Date: Mon, 13 May 2013 17:56:14 +0300
Message-ID: <5190FF0E.4020602@vmware.com> (raw)
In-Reply-To: <2768.1368454158@sss.pgh.pa.us>
References: <51878292.6080003@fooby.de>
	<14272.1367850378@sss.pgh.pa.us>
	<5187C2FE.9000305@fooby.de>
	<8415.1368200958@sss.pgh.pa.us>
	<kmj64d$qrq$1@ger.gmane.org>
	<518D71FB.9050106@timbira.com.br>
	<5190C442.3000609@vmware.com>
	<2768.1368454158@sss.pgh.pa.us>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

On 13.05.2013 17:09, Tom Lane wrote:
> Heikki Linnakangas<hlinnakangas@vmware.com>  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



view thread (10+ messages)  latest in thread

Message-ID: <5190FF0E.4020602@vmware.com>
Permalink:  ../5190FF0E.4020602@vmware.com/
Also on:    postgresql.org/message-id/5190FF0E.4020602@vmware.com

 · 

reply

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: hlinnakangas@vmware.com, tgl@sss.pgh.pa.us, euler@timbira.com.br, spam_eater@gmx.net
  Subject: Re: Inconsistency between TO_CHAR() and TO_NUMBER()
  In-Reply-To: <5190FF0E.4020602@vmware.com>
  References: <51878292.6080003@fooby.de> <14272.1367850378@sss.pgh.pa.us> <5187C2FE.9000305@fooby.de> <8415.1368200958@sss.pgh.pa.us> <kmj64d$qrq$1@ger.gmane.org> <518D71FB.9050106@timbira.com.br> <5190C442.3000609@vmware.com> <2768.1368454158@sss.pgh.pa.us> <5190FF0E.4020602@vmware.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