pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Vincent Veyron <vv.lists@wanadoo.fr>
To: David G. Johnston <david.g.johnston@gmail.com>
Cc: pgsql-general <pgsql-general@postgresql.org>
Subject: Re: unexpected character used as group separator by to_char
Date: Tue, 9 Mar 2021 22:15:04 +0100
Message-ID: <20210309221504.309aba890549a6d4e3d16fda@wanadoo.fr> (raw)
In-Reply-To: <CAKFQuwZsE5riw9cTED_uXmWHq1VYkSoGU9BZRwVb8aOvexGUWg@mail.gmail.com>
References: <20210309212821.437795da590228b5c552eead@wanadoo.fr>
	<CAKFQuwZsE5riw9cTED_uXmWHq1VYkSoGU9BZRwVb8aOvexGUWg@mail.gmail.com>

On Tue, 9 Mar 2021 13:33:19 -0700
"David G. Johnston" <david.g.johnston@gmail.com> wrote:
> 
> By using "G" you are giving up control and letting your locale settings
> decide what gets output.  You can continue to use to_char but take control
> back by being explicit, or pass actual numbers into and out of the database
> and let your front-end deal with presentation concerns.  I suggest the
> latter.

Well, that was a fast answer :-)

Indeed, replacing "G" with \s works. However, the application is destined to be multi-lingual, and number formats vary widely between countries :

1,000.25 (US)
1'000,25 (CH)
1 000,25 (FR)
1.000,25 (GER)
etc...

So, I intended to follow this advice by Tom Lane :

https://www.postgresql-archive.org/GENERAL-setting-LC-NUMERIC-td1857521.html

Having a database with the proper lc_numeric setting for each country, and using to_char/to_number to manipulate numbers is much more appealing than writing my own parser in my front end. But this weird space is getting in my way.

-- 
		Bien à vous, Vincent Veyron

https://marica.fr/
Logiciel de gestion des sinistres assurances, des dossiers contentieux et des contrats pour le service juridique






view thread (13+ messages)  latest in thread

Message-ID: <20210309221504.309aba890549a6d4e3d16fda@wanadoo.fr>
Permalink:  ../20210309221504.309aba890549a6d4e3d16fda@wanadoo.fr/
Also on:    postgresql.org/message-id/20210309221504.309aba890549a6d4e3d16fda@wanadoo.fr

 · 

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-general@postgresql.org
  Cc: vv.lists@wanadoo.fr, david.g.johnston@gmail.com
  Subject: Re: unexpected character used as group separator by to_char
  In-Reply-To: <20210309221504.309aba890549a6d4e3d16fda@wanadoo.fr>
  References: <20210309212821.437795da590228b5c552eead@wanadoo.fr> <CAKFQuwZsE5riw9cTED_uXmWHq1VYkSoGU9BZRwVb8aOvexGUWg@mail.gmail.com> <20210309221504.309aba890549a6d4e3d16fda@wanadoo.fr>

* 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