From: Tom Lane <tgl@sss.pgh.pa.us>
To: Jeroen T. Vermeulen <jtv@xs4all.nl>
Cc: pgsql-interfaces@postgresql.org
Subject: Re: GetValue(), floats, and locales
Date: Wed, 07 May 2003 12:19:02 -0400
Message-ID: <27744.1052324342@sss.pgh.pa.us> (raw)
In-Reply-To: <20030507133633.GD48885@xs4all.nl>
References: <20030507133633.GD48885@xs4all.nl>
"Jeroen T. Vermeulen" <jtv@xs4all.nl> writes:
> I just got a bothersome bug report from a libpqxx user in Hungary (where,
> as it turns out, floating-point numbers are written with decimal commas
> rather than decimal points). It appears that libpq's GetValue() delivers
> floating-point fields in localized format. The problem with this is that
> libpqxx then tries to parse the numbers using sscanf(), which apparently
> doesn't expect the number to have a decimal comma.
> This begs the question: is it libpq that represents these values using the
> client's locale, or does the server ship them in this form according to
> its own locale?
The server should always ship floats in "standard" representation.
AFAIK the only way to use localized numeric representations is to
write to_char() and to_number() calls (or use the money datatype).
If you can show us a case where plain float display does the other,
it's a bug.
libpq is not doing anything to you, in any case: it's far too stupid
to convert data at all ;-)
regards, tom lane
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 using the --to and --cc options:
reply via email
To: pgsql-interfaces@postgresql.org
Cc: tgl@sss.pgh.pa.us, jtv@xs4all.nl
Subject: Re: GetValue(), floats, and locales
In-Reply-To: <27744.1052324342@sss.pgh.pa.us>
* 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