Re: money type depreciated? - Mailing list pgsql-general

From Martijn van Oosterhout
Subject Re: money type depreciated?
Date
Msg-id 20060801205655.GD19073@svana.org
Whole thread Raw
In response to Re: money type depreciated?  (Roman Neuhauser <neuhauser@sigpipe.cz>)
List pgsql-general
On Tue, Aug 01, 2006 at 10:37:35PM +0000, Roman Neuhauser wrote:
> # karen_hill22@yahoo.com / 2006-08-01 10:18:45 -0700:
> > I read in the documentation that the money type is depreciated.  It
> > says to use the  to_char function and NUMERIC/decimal instead.  Why was
> > the money type depreciated when it was so useful?  How would be the
> > best way to use to_char and numeric to replace that type since I don't
> > want to be using a depreciated data type.
>
>     Use a custom type; IIRC Martijn van Oosterhout has something.

Indeed, I wrote a module called taggedtypes that provided a way to
create custom types based on a base type and a set of tags. One of the
uses is to take a numeric base type and have currency names as the
tags.

The end result is that you have a currency type that works like a
numeric, but will complain if you try to add values of different
currencies. Ofcourse the infrastructure is there to allow you to do
automatic conversion, and such things.

Anyway, check it out on the website. It's a bit terse, but it might
suit your needs. There's an example included in the tarball.

http://svana.org/kleptog/pgsql/taggedtypes.html

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

Attachment

pgsql-general by date:

Previous
From: Roman Neuhauser
Date:
Subject: Re: money type depreciated?
Next
From: "Eric Andrews"
Date:
Subject: Re: proper use of array datatype