From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | David Fetter <david(at)fetter(dot)org> |
Cc: | Xiaofeng Zhao <xf10036(at)hotmail(dot)com>, tomas(at)tuxteam(dot)de, Martijn van Oosterhout <kleptog(at)svana(dot)org>, "Jim C(dot) Nasby" <jim(at)nasby(dot)net>, "D'Arcy J(dot)M(dot) Cain" <darcy(at)druid(dot)net>, llonergan(at)greenplum(dot)com, sfrost(at)snowman(dot)net, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: New version of money type |
Date: | 2006-09-30 17:00:05 |
Message-ID: | 13689.1159635605@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
David Fetter <david(at)fetter(dot)org> writes:
> The "money" type is far too simplistic to model this kind of thing. A
> really sophisticated representation of money would have to take time,
> inflation/deflation, pairwise exchange rates, etc. into account. It
> would look more like a schema with a large data set and a large body
> of code loaded into it than it would a data type.
I don't think that's the appropriate functionality for a data type.
I used to be in the currency trading game (before I decided hacking
Postgres was more fun), and if you ask me, the people who want this
functionality are specifically interested in those exchange rates and
time variations --- it's exactly the purpose of their databases to
store, search, and manipulate that data, so burying it behind the scenes
in a datatype is exactly the wrong approach.
At least for what I was doing back then, a tagged type is exactly the
right thing: all we'd have wanted is for it to keep us from thinking
that adding 2 USD and 2 EUR directly was a sane computation.
Oh BTW: 10^14 is not enough dynamic range --- those guys push around
*serious* amounts of money. Bill Gates' net wealth is somewhere north
of 10^13 cents, and he's just a private citizen not a bank.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2006-09-30 17:48:01 | Re: PostgreSQL 8.2beta1 w/ VALUES |
Previous Message | David Fetter | 2006-09-30 15:57:04 | Re: New version of money type |