Money locale currency symbol position

From: Marko Mikulicic <marko(at)seul(dot)org>
To: pgsql-bugs(at)postgresql(dot)org
Subject: Money locale currency symbol position
Date: 2002-07-28 02:53:26
Message-ID: 3D435CA6.6030102@seul.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

============================================================================
POSTGRESQL BUG REPORT TEMPLATE
============================================================================

Your name : Marko Mikulicic
Your email address : marko(at)seul(dot)org

System Configuration
---------------------
Architecture (example: Intel Pentium) : *

Operating System (example: Linux 2.0.26 ELF) : Linux 2.4.18

PostgreSQL version (example: PostgreSQL-7.2.1): PostgreSQL-7.2.1

Compiler used (example: gcc 2.95.2) : *

Please enter a FULL description of your problem:
------------------------------------------------
src/backend/utils/adt/cash.c doesn't handle currency position at all.
It assumes that the currency symbol is at beggining of the string.
This is not acceptable for localized application. The situation
is also aggravated by the absence of the separator whitespace:

good: 12,32 F
bad: F12,32

Please describe a way to repeat the problem. Please try to provide a
concise reproducible example, if at all possible:
----------------------------------------------------------------------
set a european locale (say fr_FR) and start the database.

select 0::money;

it should output: 0,00 F

If you know how this problem might be fixed, list the solution below:
---------------------------------------------------------------------

The more general soultion would be to use "strfmon" function to handle
monetary output and completely ignore currency from input (either at
beginning or at end) and use "strtod" for locale support (decimal point).

The code in cash.c should be cleaned up completely from hand-made
locale handling because it is not conforming to the standards, and since
glibc has done the job much better.

I'm not sure, but it seems that "strfmon" is POSIX.

I suggest that for platforms which does not support strfmon (if it is
really POSIX) either drop locale support or provide a "strfmon"/"strtod"
emulation in a separated file/lib in order to minimize dependencies with
cash. This emulation could be based on code from glibc, if possible.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Victor Wagner 2002-07-29 13:00:22 Re: bug "\! cd"
Previous Message Tom Lane 2002-07-27 15:58:45 Re: Bug #722: SELECT FOR UPDATE bug