From: | Andy Balholm <andy(at)balholm(dot)com> |
---|---|
To: | Kevin Grittner <Kevin(dot)Grittner(at)wicourts(dot)gov> |
Cc: | <pgsql-bugs(at)postgresql(dot)org> |
Subject: | Re: dividing money by money |
Date: | 2010-03-31 18:30:38 |
Message-ID: | E464FC59-EEDD-4439-829A-74BF3483AE81@balholm.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
On Mar 31, 2010, at 11:01 AM, Kevin Grittner wrote:
> That was my first inclination, but the fact that two different
> people talked about using division by '1'::money as a way to convert
> money to another type has me nervous about using an approximate
> type. Any chance you could rework it using numeric? I know it's
> less trivial that way, but unless we provide a cast to numeric, I'm
> afraid people will use the above trick, assign it to a numeric
> variable or column, and then wonder why they've lost precision.
>
> Or I guess we could leave this as you've written it and add support
> for a cast from money to numeric.
It probably is wiser to rewrite it with the numeric type. A cast from money to numeric is theoretically ambiguous (the result could be either dollars or cents), although most people would expect dollars.
I'll see if I can rewrite it with a return type of numeric.
From | Date | Subject | |
---|---|---|---|
Next Message | Andy Balholm | 2010-03-31 22:35:29 | Re: dividing money by money |
Previous Message | Kevin Grittner | 2010-03-31 18:01:59 | Re: dividing money by money |