Re: [PATCHES] Fixes for MONEY type using locale

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "D'Arcy J(dot)M(dot) Cain" <darcy(at)druid(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCHES] Fixes for MONEY type using locale
Date: 2007-11-27 05:32:09
Message-ID: 200711270532.lAR5W9O17619@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Joshua D. Drake wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On Mon, 26 Nov 2007 23:47:04 -0500 (EST)
> Bruce Momjian <bruce(at)momjian(dot)us> wrote:
>
> > Perhaps all we need is a way to accomplish the casting so it isn't
> > automatic. This works:
> >
> > test=> SELECT regexp_replace('2343'::money::text, '[^$,]*',
> > '', 'g')::numeric; regexp_replace
> > ----------------
> > 2343.00
> > (1 row)
> >
> > but the '$' and ',' are locale-specific and I can't think of a way to
> > do this generically.
>
> With a regex?

The problem is there is no locale-independent way to determine if
'123.456' is ~123k or ~123. I think we are going to need a way to
output the MONEY value without a currency and thousands symbols.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://postgres.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2007-11-27 05:34:42 Re: [PATCHES] Proposed patch for operator lookup caching
Previous Message Joshua D. Drake 2007-11-27 05:00:15 Re: [PATCHES] Fixes for MONEY type using locale

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2007-11-27 05:34:42 Re: [PATCHES] Proposed patch for operator lookup caching
Previous Message Joshua D. Drake 2007-11-27 05:00:15 Re: [PATCHES] Fixes for MONEY type using locale