Re: New version of money type

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Luke Lonergan <llonergan(at)greenplum(dot)com>
Cc: "D'Arcy J(dot)M(dot) Cain" <darcy(at)druid(dot)net>, Stephen Frost <sfrost(at)snowman(dot)net>, pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: New version of money type
Date: 2006-09-28 20:53:34
Message-ID: 20060928205334.GD16473@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)svana(dot)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(at)svana(dot)org> http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2006-09-28 21:02:36 Darwin stuff is getting deprecated
Previous Message Tom Lane 2006-09-28 20:51:43 pgsql: Fix IS NULL and IS NOT NULL tests on row-valued expressions to