Re: [PATCHES] Fixes for MONEY type using locale

From: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
To: Bruce Momjian <bruce(at)momjian(dot)us>
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:00:15
Message-ID: 20071126210015.561aea4d@commandprompt.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

-----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?

Joshua D. Drake

- --

=== The PostgreSQL Company: Command Prompt, Inc. ===
Sales/Support: +1.503.667.4564 24x7/Emergency: +1.800.492.2240
PostgreSQL solutions since 1997 http://www.commandprompt.com/
UNIQUE NOT NULL
Donate to the PostgreSQL Project: http://www.postgresql.org/about/donate
PostgreSQL Replication: http://www.commandprompt.com/products/

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFHS6RjATb/zqfZUUQRAtZyAJ9VZeCzjX+RSGr3A9eWXTcbHwnc4gCgoZcH
LcO9KnjcycRo5YjCektSJXg=
=HZpl
-----END PGP SIGNATURE-----

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2007-11-27 05:32:09 Re: [PATCHES] Fixes for MONEY type using locale
Previous Message Bruce Momjian 2007-11-27 04:47:04 Re: [PATCHES] Fixes for MONEY type using locale

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2007-11-27 05:32:09 Re: [PATCHES] Fixes for MONEY type using locale
Previous Message Bruce Momjian 2007-11-27 04:47:04 Re: [PATCHES] Fixes for MONEY type using locale