Re: Money casting too liberal? - Mailing list pgsql-general

From Shaun Thomas
Subject Re: Money casting too liberal?
Date
Msg-id 51544B10.4000900@optionshouse.com
Whole thread Raw
In response to Re: Money casting too liberal?  (Gavan Schneider <pg-gts@snkmail.com>)
Responses Re: Money casting too liberal?
List pgsql-general
On 03/28/2013 07:43 AM, Gavan Schneider wrote:

> Personally I have ignored the money type in favour of numeric. Money
> seemed to do too much behind the scenes for my taste, but, that's me
> being lazy as well, I haven't spend much time trying to understand its
> features.

You're not the only one. In the financial industry, we can't even use
the money type for a few reasons:

1. It's very common for values to have fractional amounts in the
selected currency. Just look at gas stations... they could never use the
Money type in the US thanks to the "3.989" pricing they commonly employ.

2. You can't use the Money type for non-local currencies. Our database
may store transactions in several base currencies. Sure, the smart thing
would be to save the exchange rate at the time of the transaction and
store the local value and the rate, but then you'd have to reverse that
calculation to get the original value, and without decimals, that
conversion would be wrong in most cases.

So we use numeric. It's the only thing with the guaranteed precision we
need, and prettying up the display is easy to do client-side. We're
extremely happy to see the recent improvements in numeric performance
that seem to be coming in 9.3. :)

--
Shaun Thomas
OptionsHouse | 141 W. Jackson Blvd. | Suite 500 | Chicago IL, 60604
312-676-8870
sthomas@optionshouse.com

______________________________________________

See http://www.peak6.com/email_disclaimer/ for terms and conditions related to this email


pgsql-general by date:

Previous
From: "D'Arcy J.M. Cain"
Date:
Subject: Re: Money casting too liberal?
Next
From: Tom Lane
Date:
Subject: Re: Money casting too liberal?