Re: Money data type in PostgreSQL? - Mailing list pgsql-general

From David Garamond
Subject Re: Money data type in PostgreSQL?
Date
Msg-id 3FCD9E62.20702@zara.6.isreserved.com
Whole thread Raw
In response to Re: Money data type in PostgreSQL?  (Oliver Elphick <olly@lfix.co.uk>)
List pgsql-general
Oliver Elphick wrote:
>
> You should not regard amounts in different currencies as equivalent.
> You cannot add Euros to dollars and get a meaningful figure; so they
> should not be in the same column.

I plan to store amount in a column (NUMERIC) and currency id in another
(CHAR(3)). Plus another column for amount in 'standard' currency (e.g.
USD; all addition/sum will be done to this column).

> You should only use NUMERIC for money; any kind of floating point
> representation will lose detail somewhere along the line.  (I suppose
> you could use BIGINT for Japanese Yen.)

--
dave



pgsql-general by date:

Previous
From: Oliver Elphick
Date:
Subject: Re: Money data type in PostgreSQL?
Next
From: Alvar Freude
Date:
Subject: Cast text to bytea