Re: Extracting data from deprecated MONEY fields

Поиск
Список
Период
Сортировка
От Ken Winter
Тема Re: Extracting data from deprecated MONEY fields
Дата
Msg-id 001f01c8c7e9$97422120$6703a8c0@KenIBM
обсуждение исходный текст
Ответ на Re: Extracting data from deprecated MONEY fields  ("Joshua D. Drake" <jd@commandprompt.com>)
Ответы Re: Extracting data from deprecated MONEY fields  (Adrian Klaver <aklaver@comcast.net>)
Re: Extracting data from deprecated MONEY fields  (Shane Ambler <pgsql@Sheeky.Biz>)
Список pgsql-general
Thanks, Joshua ~

What you suggest is basically what I'm trying to do.  Where I'm stuck is in
finding a construct (a CAST or whatever) to turn the existing "money" column
data (directly or indirectly) into numeric.  I've tried to convert a column
named "amount" in the following ways, with the following results:

CAST(amount AS numeric) -> "cannot cast type money to numeric"
CAST(amount AS numeric(10,2)) -> "cannot cast type money to numeric"
CAST(amount AS decimal) -> "cannot cast type money to numeric"
CAST(amount AS text) -> "cannot cast type money to text"
CAST(amount AS varchar) -> "cannot cast type money to character varying"
to_char(money) -> "function to_char(money) does not exist"

~ Ken

> -----Original Message-----
> From: Joshua D. Drake [mailto:jd@commandprompt.com]
> Sent: Thursday, June 05, 2008 11:22 PM
> To: Ken Winter
> Cc: PostgreSQL pg-general List
> Subject: Re: [GENERAL] Extracting data from deprecated MONEY fields
>
> Ken Winter wrote:
> > I understand from
> > http://www.postgresql.org/docs/8.0/static/datatype-money.html that the
> > "money" data type is deprecated.
>
> Money is no longer deprecated in newer releases (specifically 8.3),
> although I do think it would be wise to push it to numeric.
>
> I think the way to do it would be to backup the table and edit the table
> definition from the file. Make the money a numeric. Then reload the
> table from the backup.
>
> Sincerely,
>
> Joshua D. Drake
> >


В списке pgsql-general по дате отправления:

Предыдущее
От: Sam Mason
Дата:
Сообщение: intagg memory leak
Следующее
От: "Roberts, Jon"
Дата:
Сообщение: when to reindex?