Re: New version of money type - Mailing list pgsql-hackers

From D'Arcy J.M. Cain
Subject Re: New version of money type
Date
Msg-id 20060915110501.11ae122c.darcy@druid.net
Whole thread Raw
In response to Re: New version of money type  (AgentM <agentm@themactionfaction.com>)
List pgsql-hackers
On Thu, 14 Sep 2006 14:12:30 -0400
AgentM <agentm@themactionfaction.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@druid.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.


pgsql-hackers by date:

Previous
From: "D'Arcy J.M. Cain"
Date:
Subject: Re: New version of money type
Next
From: "Albe Laurenz"
Date:
Subject: Re: [PATCHES] Linking on AIX (Was: Fix linking of OpenLDAP libraries )