Re: casting money type to float

From: "Thomas G(dot) Lockhart" <lockhart(at)alumni(dot)caltech(dot)edu>
To: David Mansfield <david(at)cobite(dot)com>
Cc: Postgres Hackers List <hackers(at)postgresql(dot)org>
Subject: Re: casting money type to float
Date: 1998-10-27 17:15:05
Message-ID: 3635FF99.B5EE696F@alumni.caltech.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> found an email from you, from Tue, 12 May 1998, where you describe the
> problems I am having with regards to casting from money to other
> types.
> "So there is some funny interaction on the casting, the same as you
> found in v6.3.2 (and presumably forever), which I will look into..."
>
> But these problems still exist in 6.4BETA2... Is this something that
> will be fixed?
>
> To summarize the problem in case it isn't fresh in your mind: casting
> a money column in a table to float8 results in gibberish. Casting a
> constant seems to work fine. Casts to other types than float8 seem
> equally broken in the table case.

How are you doing the casting? I'm having trouble figuring out what
syntax you are using to get gibberish...

- Tom

postgres=> create table mm (m money);
CREATE
postgres=> insert into mm values ('1');
INSERT 18473 1
postgres=> insert into mm values ('2.50');
INSERT 18474 1
postgres=> select * from mm;
m
-----
$1.00
$2.50
(2 rows)

postgres=> select float8(m) from mm;
ERROR: No such function 'float8' with the specified attributes
postgres=> select m * 1.0 from mm;
?column?
--------
$1.00
$2.50
(2 rows)

postgres=> select m::float8 from mm;
ERROR: No such function 'float8' with the specified attributes

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas G. Lockhart 1998-10-27 17:20:48 Re: [HACKERS] Re: AWL: PostgreSQL ODBC.
Previous Message Andreas Zeugswetter 1998-10-27 17:09:07 s_lock.h line 178