Re: dividing money by money

From: Chris Travers <chris(at)metatrontech(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: Re: dividing money by money
Date: 2010-03-30 19:07:54
Message-ID: 5ed37b141003301207w722332c3kecba1fe278047c8f@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Forgot to send to the list....

On Tue, Mar 30, 2010 at 8:25 AM, Kevin Grittner
<Kevin(dot)Grittner(at)wicourts(dot)gov> wrote:
> John R Pierce <pierce(at)hogranch(dot)com> wrote:
>> Boszormenyi Zoltan wrote:
>
>>> But then any operator between two money values would
>>> only work if both values have the same currency.
>
> That sounds like a sane limitation.
>
>> and, are there still any currenccies like old style UK where
>> the subunits aren't 100ths?   schillings or whatever
>
> I'm not sure if you're arguing for or against the database type
> knowing how to divide those to get a percentage, versus putting the
> onus on the application programmer.  Where does it make the most
> sense to you to put such logic?

With due respect, this sort of thing is rather difficult to get right
all at once.  I would suggest at some point having a modified MONEY or
maybe to avoid conflicts let's call it a CURRENCY datatype on
Pg-foundry where we can experiment and get these details right.  I am
thinking of doing a rough draft in SQL and PLPGSQL so that someone can
convert to C once everything works properly :-).

If folks are interested, I might make a simple approximation of this
that would require 8.4 or higher.  It might come in handy for
LedgerSMB too.....

Best Wishes,
Chris Travers

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Kevin Grittner 2010-03-30 19:49:10 Re: dividing money by money
Previous Message Tom Lane 2010-03-30 17:47:39 Re: BUG #5395: UPDATE on shutdown overwrites table