Re: money type depreciated?

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Karen Hill <karen_hill22(at)yahoo(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: money type depreciated?
Date: 2006-08-01 20:56:55
Message-ID: 20060801205655.GD19073@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Aug 01, 2006 at 10:37:35PM +0000, Roman Neuhauser wrote:
> # karen_hill22(at)yahoo(dot)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(at)svana(dot)org> http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Eric Andrews 2006-08-01 21:01:32 Re: proper use of array datatype
Previous Message Martijn van Oosterhout 2006-08-01 20:32:38 Re: Autovacuum help..