Are there functions for adding and subtracting this type from itself?
Or is there a simple way to do it?



Fri, 24 Jan 2003 15:41:17 -0800 (PST)
"David Durst" <ddurst@larubber.com>
Function for adding Money type
David,

> Are there functions for adding and subtracting this type from itself?
> Or is there a simple way to do it?

The MONEY type is depreciated, and should have been removed from the Postgres 
source but was missed as an oversight.   Use NUMERIC instead.

-- 
-Josh Berkus
 Aglio Database Solutions
 San Francisco


Fri, 24 Jan 2003 16:17:09 -0800
Josh Berkus <josh@agliodbs.com>
Re: Function for adding Money type
> David,
>
>> Are there functions for adding and subtracting this type from itself?
>> Or is there a simple way to do it?
>
> The MONEY type is depreciated, and should have been removed from the
> Postgres  source but was missed as an oversight.   Use NUMERIC instead.
>
> --
> -Josh Berkus
>  Aglio Database Solutions
>  San Francisco
Already done, I found it in another doc.
Thanks though



Fri, 24 Jan 2003 17:30:08 -0800 (PST)
"David Durst" <ddurst@larubber.com>
Re: Function for adding Money type
On Sun, 26 Jan 2003, D'Arcy J.M. Cain wrote:

> This year, my team is planning on improving the MONEY type.  Of course, we can
> always make it a user defined type if PostgreSQL doesn't want it.  We will at
> least put it into contrib.  However, if people think that it is useful and
> want to leave it in the main tree that's good too.  What we want to do is a)
> switch to a 64 bit integer from a 32 bit integer in order to hold amounts of
> any reasonabe size and b) allow it to be cast to and from more types.
> Perhaps we can also add the ability to specify the number of decimal places
> on output but I am not sure if that would affect the primary benefit of using
> it, speed.

Hey good news D'Arcy!  I prefer using MONEY as well.

-----------------------------------------------------------------------
Thomas Good                                  e-mail: tomg@sqlclinic.net
Programmer/Analyst                           phone:   (+1) 718.818.5528
Residential Services                         fax:     (+1) 718.818.5056
Behavioral Health Services, SVCMC-NY         mobile:  (+1) 917.282.7359

    --            Geistiges Eigentum ist Diebstahl!              --


Sun, 26 Jan 2003 08:48:01 -0500 (EST)
Thomas Good <tomg@sqlclinic.net>
Re: [SQL] Function for adding Money type
On Friday 24 January 2003 19:17, Josh Berkus wrote:
> The MONEY type is depreciated, and should have been removed from the
> Postgres source but was missed as an oversight.   Use NUMERIC instead.

Note that not all of us agree.  I had to change all of our fields from MONEY 
to NUMERIC recently because of the lack of support for MONEY but I would 
prefer to see it improved instead.  Now that we have changed we find that we 
need to create a new table for balances driven by a trigger because 
calculating balances just went up in cost with that change.  The reason is 
simply that MONEY used nothing but integer arithmetic and NUMERIC has to do a 
lot more processing in code.

This year, my team is planning on improving the MONEY type.  Of course, we can 
always make it a user defined type if PostgreSQL doesn't want it.  We will at 
least put it into contrib.  However, if people think that it is useful and 
want to leave it in the main tree that's good too.  What we want to do is a) 
switch to a 64 bit integer from a 32 bit integer in order to hold amounts of 
any reasonabe size and b) allow it to be cast to and from more types.  
Perhaps we can also add the ability to specify the number of decimal places 
on output but I am not sure if that would affect the primary benefit of using 
it, speed.

-- 
D'Arcy J.M. Cain <darcy@{druid|vex}.net>   |  Democracy is three wolves
http://www.druid.net/darcy/                |  and a sheep voting on
+1 416 425 1212     (DoD#0082)    (eNTP)   |  what's for dinner.

Sun, 26 Jan 2003 08:53:21 -0500
"D'Arcy J.M. Cain" <darcy@druid.net>
Re: [SQL] Function for adding Money type
On Sun, 2003-01-26 at 13:53, D'Arcy J.M. Cain wrote:

> This year, my team is planning on improving the MONEY type.  Of course, we can 
> always make it a user defined type if PostgreSQL doesn't want it.  We will at 
> least put it into contrib.  However, if people think that it is useful and 
> want to leave it in the main tree that's good too.  What we want to do is a) 
> switch to a 64 bit integer from a 32 bit integer in order to hold amounts of 
> any reasonabe size and b) allow it to be cast to and from more types.  
> Perhaps we can also add the ability to specify the number of decimal places 
> on output but I am not sure if that would affect the primary benefit of using 
> it, speed.

A money type needs to specify what currency is held.  The current one
changes the currency with the locale, which makes nonsense of existing
data.

-- 
Oliver Elphick                                Oliver.Elphick@lfix.co.uk
Isle of Wight, UK                             http://www.lfix.co.uk/oliver
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839  932A 614D 4C34 3E1D 0C1C
                 ========================================
     "Wash me thoroughly from mine iniquity, and cleanse me 
      from my sin. For I acknowledge my transgressions; and 
      my sin is ever before me. Against thee, thee only, 
      have I sinned, and done this evil in thy sight..."
                                   Psalms 51:2-4 


26 Jan 2003 16:03:00 +0000
Oliver Elphick <olly@lfix.co.uk>
Re: [SQL] Function for adding Money type
Oliver Elphick wrote:
> On Sun, 2003-01-26 at 13:53, D'Arcy J.M. Cain wrote:
> 
> > This year, my team is planning on improving the MONEY type.  Of course, we can 
> > always make it a user defined type if PostgreSQL doesn't want it.  We will at 
> > least put it into contrib.  However, if people think that it is useful and 
> > want to leave it in the main tree that's good too.  What we want to do is a) 
> > switch to a 64 bit integer from a 32 bit integer in order to hold amounts of 
> > any reasonabe size and b) allow it to be cast to and from more types.  
> > Perhaps we can also add the ability to specify the number of decimal places 
> > on output but I am not sure if that would affect the primary benefit of using 
> > it, speed.
> 
> A money type needs to specify what currency is held.  The current one
> changes the currency with the locale, which makes nonsense of existing
> data.

Agreed.  We can default to locale but need a way of overriding that,
ideally with atttypmod at the column level.  I assume this will be done
for 7.4 (you said "this year")?

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Mon, 27 Jan 2003 15:14:57 -0500 (EST)
Bruce Momjian <pgman@candle.pha.pa.us>
Re: [SQL] Function for adding Money type