Re: monetary bug

From: Oliver Elphick <olly(at)lfix(dot)co(dot)uk>
To: Mike Mascari <mascarm(at)mascari(dot)com>
Cc: Dennis Bjorklund <db(at)zigo(dot)dhs(dot)org>, Peter Eisentraut <peter_e(at)gmx(dot)net>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Mahmoud Taghizadeh <m_taghi(at)yahoo(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: monetary bug
Date: 2004-08-23 14:19:26
Message-ID: 1093270766.2020.10.camel@linda
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, 2004-08-23 at 14:11, Mike Mascari wrote:
...
> MONEY seems "odd" because it is interpreting its internal
> representation based upon locale and the locale is also determining
> its possible representation, so one database's MONEY isn't really
> the same type as another database's MONEY.
>
> However, Date & Darwen's type model suggests that a database should
> have support for types like WEIGHT, LENGTH, and TEMPERATURE,
> although they could certainly be left for the user to define. They
> define possible representations and THE_ functions as the means to
> support multiple units (among other purposes.) For example, a LENGTH
> type would have the following selector functions:
>
> LENGTH LENGTH_IN_INCHES(NO_OF_INCHES RATIONAL);
> LENGTH LENGTH_IN_FEET(NO_OF_FEET RATIONAL);
> LENGTH LENGTH_IN_CM(NO_OF_CM RATIONAL);

The difference between these and money is that there is a constant
relationship between units; you may measure a distance in inches or
centimetres, but it is always the same distance. The conversions
between different units of money vary minute by minute. Furthermore the
unit of money is very important, whereas the unit of length is not. You
cannot meaningfully add amounts of money in different currencies, even
if you convert to some base currency first.

--
Oliver Elphick olly(at)lfix(dot)co(dot)uk
Isle of Wight http://www.lfix.co.uk/oliver
GPG: 1024D/A54310EA 92C8 39E7 280E 3631 3F0E 1EC0 5664 7A2F A543 10EA
========================================
"For God hath not appointed us to wrath, but to obtain
salvation by our Lord Jesus Christ, Who died for us,
that, whether we wake or sleep, we should live
together with him."
I Thessalonians 5:9,10

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Marc G. Fournier 2004-08-23 14:41:34 Re: [PATCHES] ALTER SCHEMA ... SET TABLESPACE
Previous Message Bruce Momjian 2004-08-23 14:09:33 Re: [PATCHES] ALTER SCHEMA ... SET TABLESPACE