Re: unexpected character used as group separator by to_char

From: Vincent Veyron <vv(dot)lists(at)wanadoo(dot)fr>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: unexpected character used as group separator by to_char
Date: 2021-03-09 23:03:45
Message-ID: 20210310000345.2244070de113915b39ae2fca@wanadoo.fr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, 09 Mar 2021 16:22:07 -0500
Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> The point here is that 'G' and related format codes act as specified by
> your LC_MONETARY locale. If you don't like the results, you need to use
> a different locale.

This is a numeric(10,2) type field though. I tried casting it to money type, with lc_monetary set to "fr_FR.UTF-8", same weird space

>
> (I suppose you could also use regexp_replace to convert random forms
> of whitespace to plain ASCII space.)

No dice. 'G' formatting looks like a whitespace, but is different (it appears to be slightly narrower when displayed in html, too) :

select regexp_replace(to_char(1234.56, 'FM999 990D00'), E'[\\s]', 'x');
regexp_replace
----------------
1x234,56
(1 row)

select regexp_replace(to_char(1234.56, 'FM999G990D00'), E'[\\s]', 'x');
regexp_replace
----------------
1 234,56
(1 row)

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Rob Sargent 2021-03-09 23:09:16 Re: unexpected character used as group separator by to_char
Previous Message Tom Lane 2021-03-09 22:21:49 Re: Need help with clarification on stored procedure support in PostGreSQL database