Re: lc_numeric and decimal delimiter - Mailing list pgsql-hackers

From Andrew Dunstan
Subject Re: lc_numeric and decimal delimiter
Date
Msg-id 43715ED9.2040500@dunslane.net
Whole thread Raw
In response to lc_numeric and decimal delimiter  (Gavin Sherry <swm@linuxworld.com.au>)
List pgsql-hackers

Gavin Sherry wrote:

>Hi all,
>
>I am at OpenDBCon in Germany. People are complaining about floats/numerics
>not accepting German/European conventions for the delimiter point -- a
>comma. This is hard coded into the the numeric input parser but,
>naturally, we use strtod() in else where. I'm not sure about the locale
>stuff and whether it deals with it. Are we in the wrong here?
>  
>

If we are it is apparently by design. pg_locale.c says:
 * The other categories, LC_MONETARY, LC_NUMERIC, and LC_TIME are also* settable at run-time.  However, we don't
actuallyset those locale* categories permanently.  This would have bizarre effects like no* longer accepting standard
floating-pointliterals in some locales.* Instead, we only set the locales briefly when needed, cache the* required
informationobtained from localeconv(), and set them back.* The cached information is only used by the formatting
functions*(to_char, etc.) and the money type.
 


Personally, I am inclined to think there should at least be a setting 
that allows input according to locale settings, even if it would 
disallow "standard" floating point strings. Maybe one of the protesting 
Europeans  would like to make a proposal?

cheers

andrew




pgsql-hackers by date:

Previous
From: "Gevik babakhani"
Date:
Subject: compiling on windows with mingw
Next
From: daveg
Date:
Subject: Re: Exclusive lock for database rename