Re: Failing example for to_number()
Erwin Brandstetter <brsaweda@gmail.com>
From: Erwin Brandstetter <brsaweda@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: "David G. Johnston" <david.g.johnston@gmail.com>, "pgsql-docs@postgresql.org" <pgsql-docs@postgresql.org>
Date: 2017-09-03T17:13:34Z
Lists: pgsql-docs
On 28 August 2017 at 22:53, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Erwin Brandstetter <brsaweda@gmail.com> writes:
> > On 21 August 2017 at 16:30, David G. Johnston <
> david.g.johnston@gmail.com>
> > wrote:
> >> On Mon, Aug 21, 2017 at 5:36 AM, Erwin Brandstetter <brsaweda@gmail.com
> >
> >> wrote:
> >>> The example fails for locales where the comma (',') does not happen to
> be
> >>> the group separator and the dot ('.') is not the decimal point.
>
> >> If one wants to try the example in a language other than in which the
> >> example was written they should modify it so that the literal number
> being
> >> parsed in written in conformance to the locale definition for the
> language
> >> you are using.
>
> > I guess there should be some more explanation.
>
> Yeah. How about adding something like this to the "Usage notes for
> numeric formatting" between tables 9-26 and 9-27:
>
> * The pattern characters S, L, D, and G represent the sign,
> currency symbol, decimal point, and thousands separator characters
> defined by the current locale (see lc_monetary and lc_numeric).
> The pattern characters period and comma represent those exact
> characters, with the meanings of decimal point and thousands
> separator, regardless of locale.
>
>
That should help to clear up some confusion, especially for to_number(). I
suggest some minor modifications:
* The pattern characters S, L, D, and G represent the sign,
currency symbol, decimal point, and group separator characters
defined by the current locale (see lc_monetary and lc_numeric).
The pattern characters period (.) and comma (,) represent decimal
point and group
separator, regardless of locale.
Regards
Erwin Brandstetter
Commits
-
Improve docs about numeric formatting patterns (to_char/to_number).
- e19e12be4833 9.4.15 landed
- dbc7a7d9201d 9.6.6 landed
- d4ab7808bc58 9.2.24 landed
- ce5dcf54b942 11.0 landed
- 669bef911c00 9.3.20 landed
- 5c81c881f7ca 9.5.10 landed
- 09ec0eb7a6e8 10.0 landed