Re: Inconsistency between TO_CHAR() and TO_NUMBER() - Mailing list pgsql-bugs

From Thomas Kellerer
Subject Re: Inconsistency between TO_CHAR() and TO_NUMBER()
Date
Msg-id kmj64d$qrq$1@ger.gmane.org
Whole thread Raw
In response to Re: Inconsistency between TO_CHAR() and TO_NUMBER()  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Inconsistency between TO_CHAR() and TO_NUMBER()  (Euler Taveira <euler@timbira.com.br>)
List pgsql-bugs
Tom Lane wrote on 10.05.2013 17:49:
> I looked into this, and find that the reason it misbehaves is that
> NUM_numpart_from_char() will treat a '.' as being a decimal point
> *without any regard to locale considerations*.  So even if we have
> a locale-dependent format string and a locale that says '.' is a
> thousands separator, it does the wrong thing.
>
> It's a bit surprising nobody's complained of this before.
>
> I propose the attached patch.  I'm slightly worried though about whether
> this might break any existing applications that are (incorrectly)
> depending on a D format specifier being able to match '.' regardless of
> locale.  Perhaps we should only apply this to HEAD and not back-patch?

The manual claims that 'D' is locale dependent (whereas '.' is not), so
_theoretically_ a back patch would make sense I guess.

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: Inconsistency between TO_CHAR() and TO_NUMBER()
Next
From: Joel Roller
Date:
Subject: Re: BUG #8143: Backend segmentation fault in pg_trgm