On Tue, Aug 01, 2006 at 10:37:35PM +0000, Roman Neuhauser wrote: > # karen_hill22@xxxxxxxxx / 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@xxxxxxxxx> http://svana.org/kleptog/ > From each according to his ability. To each according to his ability to litigate.
Attachment:
signature.asc
Description: Digital signature