Re: Turn off "money" formatting?

From: Brendan Jurd <blakjak(at)blakjak(dot)sytes(dot)net>
To: Jerry <jerry(dot)levan(at)eku(dot)edu>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Turn off "money" formatting?
Date: 2004-06-06 23:03:13
Message-ID: 40C3A2B1.6040903@blakjak.sytes.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

If you need to be able to cast money to numeric, you can just write your
own cast. This is one of the things about postgres that I dearly love.

You could probably even write the cast function in SQL using regular
expressions.

Then, you just write a query with an explicit cast, e.g. SELECT foo ::
numeric FROM bar;

I noticed in the docs that the money type is actually deprecated, so you
probably want to consider converting your column to the numeric type
regardless.

BJ

Jerry wrote:

>Is it possible to turn off the "$" and "," that appear in "money" formatted
>columns so I can dump the table in a numeric format?
>
>The man page hints that lc_monetary controls the formatting but I
>cannot find any clues on what to do...
>
>Apparently money cannot be cast to anything.
>
>I don't think it will be hard to write a custom tcl/perl
>script that takes a "copy checks to...." command to do the task
>but I would like a cleaner solution....
>
>
>Jerry
>
>---------------------------(end of broadcast)---------------------------
>TIP 8: explain analyze is your friend
>
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jeffrey Melloy 2004-06-06 23:25:42 tsearch2 queries faster than expected
Previous Message Greg Sabino Mullane 2004-06-06 22:57:42 Re: Check for prepared statement