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

From Jim C. Nasby
Subject Re: New version of money type
Date
Msg-id 20060928233211.GF34238@nasby.net
Whole thread Raw
In response to Re: New version of money type  ("D'Arcy J.M. Cain" <darcy@druid.net>)
Responses Re: New version of money type  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: New version of money type  (Martijn van Oosterhout <kleptog@svana.org>)
List pgsql-hackers
On Thu, Sep 28, 2006 at 05:19:47PM -0400, D'Arcy J.M. Cain wrote:
> On Thu, 28 Sep 2006 22:53:34 +0200
> Martijn van Oosterhout <kleptog@svana.org> wrote:
> > Every new type needs to have a well-defined use-case before it can be
> > considered for includion.
> 
> Well, it is already included.  The current proposal is simply to
> improve the existing type.  I guess you are arguing a different
> proposal altogether - to remove the existing type.
The existing type is depricated and has been since at least 8.1; so yes,
it's slated for removal.

> > Currently we have:
> > - Is possibly faster than numeric
> 
> I suppose I should quantify this but it's hard to get motivated after
> the many man-hours (mine and my staff) I had to spend on code and
> schema optimizations I needed to do just to get closer to the previous
> speed our aps had before we converted from money to numeric.  I will
> try to find time to put together a test that appoximates that real
> world example.
> 
> > - Takes less space than numeric
> 
> Never really considered this a major improvement over numeric given the
> cost of disk these days.  I suppose it could be contributing to the
> speed increase.
Less space == more speed

> > - Customisable output (only one currency at a time though)
> > - Fixed number of decimal places
> 
> The original code actually handled number of decimal places.  It tended
> to cause problems though.  These are areas that the existing type, as
> well as the proposed change, could be worked on.  I would hesitate to
> work on both together though and going to 64bit will probably add more
> value right now than those things, certainly for existing users of the
> type.
> 
> By the way, the current proposal actually removes the currency symbol
> but I have received complaints about that.  It should probably go back
> just because it is outside of the scope of the primary change.  That
> can be dealt with later.

Perhaps a good compromise would be to call your type 'USD' or something
similar. I can see where there's use for it, but it seems too limited to
consider it a generic money type.

What would be ideal is a money type that stored what currency was used
and let you change precision (within reason).
-- 
Jim Nasby                                            jim@nasby.net
EnterpriseDB      http://enterprisedb.com      512.569.9461 (cell)


pgsql-hackers by date:

Previous
From: "Henry B. Hotz"
Date:
Subject: Re: JAVA Support
Next
From: "Jim C. Nasby"
Date:
Subject: Re: Patch: Tie stats options to autovacuum in postgresql.conf