On Mon, Apr 5, 2010 at 4:37 PM, Kevin Grittner
wrote:
> John R Pierce wrote:
>> Chris Travers wrote:
>>> Hmm... Back to the drawing board on that helper module :-).
>>
>> like I said, its a big tarpit.
>
> If you start up on this again, you might want to start a new thread
> with a more descripti
John R Pierce wrote:
> Chris Travers wrote:
>> Hmm... Back to the drawing board on that helper module :-).
>
> like I said, its a big tarpit.
If you start up on this again, you might want to start a new thread
with a more descriptive subject. Those who weren't interested in
Andy's issue might
Chris Travers wrote:
Hmm... Back to the drawing board on that helper module :-).
like I said, its a big tarpit.
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
Hi Chris,
Many thanks for your comments.
On Mon, Apr 5, 2010 at 10:16 AM, Chris Browne wrote:
> Indeed.
>
> You can only be certain of there actually being a conversion if the
> transaction directly involved a conversion between currencies.
>
> Thus...
>
> 1. If I buy materials using $USD on t
to...@tuxteam.de writes:
> On Fri, Apr 02, 2010 at 10:18:24AM -0700, Chris Travers wrote:
>
>> Suppose I live in Canada and I have two checking accounts for my
>> business, one in CAD and one in USD. In essence I have to account for
>> a floating balance of a foreign currency [...]
>>
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On Fri, Apr 02, 2010 at 10:18:24AM -0700, Chris Travers wrote:
> Suppose I live in Canada and I have two checking accounts for my
> business, one in CAD and one in USD. In essence I have to account for
> a floating balance of a foreign currency [...]
On Fri, Apr 2, 2010 at 9:51 AM, Dimitri Fontaine wrote:
>> One could also then store monetary[] arrays for addressing specific
>> denomination storage. I.e. "When closing the till we had 26 pennies,
>> 53 nickles, 12 quarters, 25 $1 bills, 35 $5 bills, 15 $10 bills, and 5
>> $20 bills."
>>
>> Th
Chris Travers writes:
> Ok. Here is my application: I write a multi-currency accounting
> program backed by PostgreSQL. After 1.3 is released (2Q this year),
> we expect to be doing a full redesign.
>
> What I am thinking about is having a custom data type, something like:
I'd be interested in
Andy Balholm wrote:
> OK. Here is the whole thing in C
Cool! I'll take it for a spin when I get a little time.
I guess there's not much point adding that TODO item now. ;-)
-Kevin
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http
On Apr 1, 2010, at 7:57 AM, Kevin Grittner wrote:
> I'm inclined to think it's better to have an explicit cast from
> money to numeric, as long as it is exact, and leave the division of
> money by money as float8. It does sort of beg the question of
> whether we should support a cast back in the o
Andy Balholm wrote:
>> That's hardly an improvement if you're concerned about lack of
>> exactness.
>
> I know; I lose a couple of digits by using float8 instead of
> numeric, but it's much simpler and faster
It also has the advantage of being symmetrical with the other
operators.
> and if
> That's hardly an improvement if you're concerned about lack of
> exactness.
I know; I lose a couple of digits by using float8 instead of numeric, but it's
much simpler and faster, and if it returned numeric people would _think_ it was
exact.
And if we have a cast to numeric, people who want t
Andy Balholm writes:
> I tried rewriting my function to use numeric, but I discovered that numeric
> division is not exact. (Otherwise SELECT 1::numeric / 3::numeric would result
> in an infinite loop.) So I went back to my float8 version and wrote a cast
> from money to numeric.
That's hardly
> Or I guess we could leave this as you've written it and add support
> for a cast from money to numeric.
I tried rewriting my function to use numeric, but I discovered that numeric
division is not exact. (Otherwise SELECT 1::numeric / 3::numeric would result
in an infinite loop.) So I went back
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 usin
Andy Balholm wrote:
> quotient = (float8)dividend / (float8)divisor;
> PG_RETURN_FLOAT8(quotient);
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 approxi
On Mar 31, 2010, at 7:07 AM, Kevin Grittner wrote:
> (I was going to mark the TODO as an easy one.)
I thought it would be pretty simple, too, so I decided to go ahead and write
and test it as an external module.
I think the function definition could be pasted directly into an appropriate
pl
Chris Travers wrote:
> Just thinking about the more general problem and how things could
> be handled more gracefully...
Sure, but in the meantime, consider:
test=# select '12'::money * '2'::numeric;
?column?
--
$24.00
(1 row)
test=# select '24'::money / '2'::numeric;
?column?
On Tue, Mar 30, 2010 at 12:22 PM, Kevin Grittner
wrote:
> [Did you mean to take this off-list, or was that accidental?]
Accidental.
>
> Chris Travers wrote:
>
>> With due respect, this sort of thing is rather difficult to get
>> right all at once.
>
> Division of two fixed-point numbers we alrea
I wrote:
> yielding some non-money numeric type (like perhaps float8).
Hmmm... Given that we've already had a couple posts on the idea
that dividing by '1'::money could convert money to something more
general, I guess it would be safer to stick to numeric.
-Kevin
--
Sent via pgsql-bugs mai
Chris Travers wrote:
> With due respect, this sort of thing is rather difficult to get
> right all at once.
The existing type is fixed point and we know how to add and subtract
two of them. I don't think it's all that difficult to add division,
yielding some non-money numeric type (like perha
Forgot to send to the list
On Tue, Mar 30, 2010 at 8:25 AM, Kevin Grittner
wrote:
> John R Pierce 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.
>
>> a
John R Pierce 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? sch
Boszormenyi Zoltan wrote:
> How about improving the money type so it can store
> values in different currencies?
Have you seen "taggedtypes"?
--
Alvaro Herrerahttp://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.
--
Sent via pgsql-bugs mai
John R Pierce írta:
> Boszormenyi Zoltan wrote:
>> Loading this dump into another database that happens
>> to have a different locale than hu_HU fails.
>>
>> But then any operator between two money values would
>> only work if both values have the same currency.
>>
>
> indeed, its all a big tarp
Boszormenyi Zoltan wrote:
Loading this dump into another database that happens
to have a different locale than hu_HU fails.
But then any operator between two money values would
only work if both values have the same currency.
indeed, its all a big tarpit. next, you'll want currency convers
Kevin Grittner írta:
> Andy Balholm wrote:
>
>
>> The ability to divide money by money would be useful for finding
>> what percent one money value is of another.
>>
>
> That certainly sounds useful and natural to me. I don't think it
> rises to the level of a *bug*, but it's a reasona
On 2010-03-30, Kevin Grittner wrote:
> Andy Balholm wrote:
>
>> The ability to divide money by money would be useful for finding
>> what percent one money value is of another.
>
> That certainly sounds useful and natural to me. I don't think it
> rises to the level of a *bug*, but it's a rea
Andy Balholm wrote:
> The ability to divide money by money would be useful for finding
> what percent one money value is of another.
That certainly sounds useful and natural to me. I don't think it
rises to the level of a *bug*, but it's a reasonable request for
enhancement. If there are no
When I divide a money value by another money value, I get an error message, as
follows:
***
psql (8.4.1)
Type "help" for help.
postgres=# select version();
version
30 matches
Mail list logo