Money data type in PostgreSQL?

From: David Garamond <lists(at)zara(dot)6(dot)isreserved(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Money data type in PostgreSQL?
Date: 2003-12-03 07:02:37
Message-ID: 3FCD8A8D.6080902@zara.6.isreserved.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

What do people recommend for storing money amounts? I've seen people use
NUMERIC(18,3) and other use NUMERIC(18,4). Which one is more appropriate
and why? This is considering various existing currencies, some having
low rates (like IDR, in which you can have large amount up to hundreds
of trillions) and some high rates (like USD, in which you can have small
amount like 0.1 cent). Are there places/industries which involve values
lower than 0.1 cent?

And what about 'factor' field in currency conversion table? Should I use
REAL, or DOUBLE PRECISION (do we need 15-16 digit precision?) or NUMERIC
(exact numbers). The factor should range between 1E-3 (e.g. converting
IDR to USD) to 1E4 (e.g. converting IDR to pounds/euros).

--
dave

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ausrack Webmaster 2003-12-03 07:25:14 Re: DBD::Pg problem
Previous Message Martijn van Oosterhout 2003-12-03 06:51:54 Re: DBD::Pg problem