Re: New version of money type

From: "D'Arcy J(dot)M(dot) Cain" <darcy(at)druid(dot)net>
To: AgentM <agentm(at)themactionfaction(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: New version of money type
Date: 2006-09-15 15:05:01
Message-ID: 20060915110501.11ae122c.darcy@druid.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, 14 Sep 2006 14:12:30 -0400
AgentM <agentm(at)themactionfaction(dot)com> wrote:
> If you force the locale into the money type, then the entire column
> must be of the same currency. That seems like an unnecessary
> limitation. Does your type support banker's rounding?

The whole point of money is to have a high speed type suitable for
accounting apps. I had an application that used money that we had to
switch to numeric due to the size limitation. When we did we saw a
dramatic degredation in performance. The app was a gift card system
that tracked card balances. A card might have hundreds of transactions
and one client might have millions of cards. We had to sum all of
those transactions grouped by card. It would have been great to have
been able to keep the original money type but total sales broke the
limit.

We use rint(), same as the previous version. I know that that isn't
precisely banker's rounding. I think that those special rules would
have to be handled in code. In that environment you would probably
want to do that for auditing (code and otherwise) purposes.

--
D'Arcy J.M. Cain <darcy(at)druid(dot)net> | Democracy is three wolves
http://www.druid.net/darcy/ | and a sheep voting on
+1 416 425 1212 (DoD#0082) (eNTP) | what's for dinner.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Albe Laurenz 2006-09-15 15:05:14 Re: [PATCHES] Linking on AIX (Was: Fix linking of OpenLDAP libraries )
Previous Message D'Arcy J.M. Cain 2006-09-15 14:58:53 Re: New version of money type