Money locale currency symbol position - Mailing list pgsql-bugs

From Marko Mikulicic
Subject Money locale currency symbol position
Date
Msg-id 3D435CA6.6030102@seul.org
Whole thread Raw
Responses Re: Money locale currency symbol position
List pgsql-bugs
============================================================================
                          POSTGRESQL BUG REPORT TEMPLATE
============================================================================


Your name               : Marko Mikulicic
Your email address      : marko@seul.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.

pgsql-bugs by date:

Previous
From: paviles@its.co.cr
Date:
Subject: Bug #722: SELECT FOR UPDATE bug
Next
From: paviles@its.co.cr
Date:
Subject: Select For Update bug???