Re: New version of money type - Mailing list pgsql-hackers

From Martijn van Oosterhout
Subject Re: New version of money type
Date
Msg-id 20060928205334.GD16473@svana.org
Whole thread Raw
In response to Re: New version of money type  ("Luke Lonergan" <llonergan@greenplum.com>)
Responses Re: New version of money type  ("D'Arcy J.M. Cain" <darcy@druid.net>)
List pgsql-hackers
On Thu, Sep 28, 2006 at 01:29:57PM -0700, Luke Lonergan wrote:
> Martijn,
>
> On 9/28/06 12:42 PM, "Martijn van Oosterhout" <kleptog@svana.org> wrote:
>
> > - Only supports one currency (dollars)
>
> What are the manifestations of this?

test=# select '100'::money; money
---------$100.00
(1 row)

The use of the dollar sign and the two decimal places make it wrong for
the vast majority of the world's population.

Now, there is some localization involved, so you can play tricks like:

test=# set lc_monetary ='nl_NL';
SET
test=# select '100'::money;  money
-----------EUR100,00
(1 row)

Oops, by changing a GUC variable we just changed the semantic value of
every currency field in the database. You still can't change the number
of decimal places though.

> > - Only supports one scale (yen has no decimal normally, but what if you
> > want to track hundredths of a dollar-cent?)
>
> So, without a quantified benefit, this is certainly a non-starter.

Every new type needs to have a well-defined use-case before it can be
considered for includion.

Currently we have:
- Is possibly faster than numeric
- Takes less space than numeric
- Customisable output (only one currency at a time though)
- Fixed number of decimal places

What else?
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

pgsql-hackers by date:

Previous
From: "Luke Lonergan"
Date:
Subject: Re: New version of money type
Next
From: Tom Lane
Date:
Subject: Darwin stuff is getting deprecated