Re: casting money type to float

Started by Thomas G. Lockhartabout 27 years ago1 messages
#1Thomas G. Lockhart
lockhart@alumni.caltech.edu

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