Re: Money casting too liberal?

Поиск
Список
Период
Сортировка
От Shaun Thomas
Тема Re: Money casting too liberal?
Дата
Msg-id 51544B10.4000900@optionshouse.com
обсуждение исходный текст
Ответ на Re: Money casting too liberal?  (Gavan Schneider <pg-gts@snkmail.com>)
Ответы Re: Money casting too liberal?
Список 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 по дате отправления:

Предыдущее
От: "D'Arcy J.M. Cain"
Дата:
Сообщение: Re: Money casting too liberal?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Money casting too liberal?