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

From David Fetter
Subject Re: New version of money type
Date
Msg-id 20060930155703.GI24766@fetter.org
Whole thread Raw
In response to Re: New version of money type  ("Xiaofeng Zhao" <xf10036@hotmail.com>)
Responses Re: New version of money type  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Sat, Sep 30, 2006 at 11:36:04AM -0400, Xiaofeng Zhao wrote:
> >I feel silly for even mentioning this, but there are less than 256
> >countries in the UN, and as far as I know, each has at most one
> >currency, so you could use 8 bits instead of 15.
> >
> That's not always true, e.g. China has RMB and HKD.  Also Taiwan is
> not a member country of UN but I don't think one would exclude TWD.

Right.  There are several countries whose currency is USD, so I still
contend that at any given instant, there are fewer than 256
currencies, so we're back to 8 bits.

> There'll also times a country may transit from one currency to
> another.  Even a currency (currency of most continental European
> countries before Euro) is no more being used, it may still need to
> be supported.

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.

Cheers,
D
-- 
David Fetter <david@fetter.org> http://fetter.org/
phone: +1 415 235 3778        AIM: dfetter666                             Skype: davidfetter

Remember to vote!


pgsql-hackers by date:

Previous
From: "Xiaofeng Zhao"
Date:
Subject: Re: New version of money type
Next
From: Tom Lane
Date:
Subject: Re: New version of money type