Skip site navigation (1) Skip section navigation (2)

Re: dividing money by money

From: Boszormenyi Zoltan <zb(at)cybertec(dot)at>
To: Kevin Grittner <Kevin(dot)Grittner(at)wicourts(dot)gov>
Cc: andy(at)balholm(dot)com, pgsql-bugs(at)postgresql(dot)org
Subject: Re: dividing money by money
Date: 2010-03-30 08:09:34
Message-ID: 4BB1B1BE.1040603@cybertec.at (view raw or flat)
Thread:
Lists: pgsql-bugs
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 reasonable request for
> enhancement.  If there are no objections I'll add it to the TODO
> list.
>   

How about improving the money type so it can store
values in different currencies?

=# create table money1 (x money);
CREATE TABLE
=# insert into money1 values ('1');
INSERT 0 1
=# select * from money1;
   x   
--------
 Ft1,00
(1 sor)

=# insert into money1 values ('$1');
ERROR:  invalid input syntax for type money: "$1"

pg_dump -t money1:

==================
Ft1,00
\.
==================

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.

Best regards,
Zoltán Böszörményi

-- 
Bible has answers for everything. Proof:
"But let your communication be, Yea, yea; Nay, nay: for whatsoever is more
than these cometh of evil." (Matthew 5:37) - basics of digital technology.
"May your kingdom come" - superficial description of plate tectonics

----------------------------------
Zoltán Böszörményi
Cybertec Schönig & Schönig GmbH
http://www.postgresql.at/


In response to

Responses

pgsql-bugs by date

Next:From: John R PierceDate: 2010-03-30 08:13:05
Subject: Re: dividing money by money
Previous:From: Jasen BettsDate: 2010-03-30 07:56:34
Subject: Re: dividing money by money

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group