Re: dangers of setlocale() in backend (was: problem with float8 input format) - Mailing list pgsql-general

From Karel Zak
Subject Re: dangers of setlocale() in backend (was: problem with float8 input format)
Date
Msg-id Pine.LNX.3.96.1000814135745.4690B-100000@ara.zf.jcu.cz
Whole thread Raw
In response to dangers of setlocale() in backend (was: problem with float8 input format)  (Louis-David Mitterrand <cunctator@apartia.ch>)
List pgsql-general
On Sat, 12 Aug 2000, Louis-David Mitterrand wrote:

> On Sat, Aug 12, 2000 at 12:15:26PM -0400, Tom Lane wrote:
> > Louis-David Mitterrand <cunctator@apartia.ch> writes:
> > > When "seller_locale" is, for instance, "de_DE", then I get theses
> > > errors:
> > >     ERROR: Bad float8 input format '0.05'
> > > Is Postgres expecting the float as 0,05 (notice the comma) because of
> > > the locale?

 The postgreSQL allows to work with locale-numbers. See to_char()
and to_number() functions.

test=# select to_char(1234.456, '9G999D999');
  to_char
------------
  1 234,456
(1 row)

test=# select to_number('1 234,457',  '9G999D999');
 to_number
-----------
  1234.457
(1 row)


 And your backend will out of next Tom's note :-)

> > IMPORTANT: changing the backend's locale on-the-fly is an EXTREMELY
> > DANGEROUS thing to do, and I strongly recommend that you find another
> > way to solve your problem.

                    Karel


pgsql-general by date:

Previous
From: Andreas Tille
Date:
Subject: Servlet examples
Next
From: Carlos Felipe Zirbes
Date:
Subject: PostGres and ERwin