X-Original-To: pgsql-interfaces@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id D538E476508 for ; Wed, 7 May 2003 12:18:59 -0400 (EDT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id 7ADF0476536 for ; Wed, 7 May 2003 12:18:57 -0400 (EDT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h47GJ2U6027745; Wed, 7 May 2003 12:19:02 -0400 (EDT) To: "Jeroen T. Vermeulen" Cc: pgsql-interfaces@postgresql.org Subject: Re: GetValue(), floats, and locales In-reply-to: <20030507133633.GD48885@xs4all.nl> References: <20030507133633.GD48885@xs4all.nl> Comments: In-reply-to "Jeroen T. Vermeulen" message dated "Wed, 07 May 2003 15:36:33 +0200" Date: Wed, 07 May 2003 12:19:02 -0400 Message-ID: <27744.1052324342@sss.pgh.pa.us> From: Tom Lane X-Spam-Status: No, hits=-32.3 required=5.0 tests=BAYES_00,EMAIL_ATTRIBUTION,IN_REP_TO,QUOTED_EMAIL_TEXT, REFERENCES,REPLY_WITH_QUOTES autolearn=ham version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-Archive-Number: 200305/20 X-Sequence-Number: 4138 "Jeroen T. Vermeulen" 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