Re: [HACKERS] money data type and conversions

From: Duane Currie <dcurrie(at)sandman(dot)acadiau(dot)ca>
To: maillist(at)candle(dot)pha(dot)pa(dot)us (Bruce Momjian)
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] money data type and conversions
Date: 1999-06-22 17:39:19
Message-ID: 199906221739.OAA04903@sandman.acadiau.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Well, can't explain the why's...

But I have the code to add to cash.c and cash.h to add the conversion
functions, but still have to figure out how to get PostgreSQL to recognize
it... Guessing... it's in fmgrtab.c right?

Duane

> Can someone explain why our money type in 6.5 requires quotes, and why
> there is no int() function for it?
>
> ---------------------------------------------------------------------------
>
>
> test=> create table t(x money);
> CREATE
> test=> insert into t values (3.3);
> ERROR: Attribute 'x' is of type 'money' but expression is of type 'float8'
> You will need to rewrite or cast the expression
> test=> insert into t values (3.33);
> ERROR: Attribute 'x' is of type 'money' but expression is of type 'float8'
> You will need to rewrite or cast the expression
> test=> insert into t values (money(3.33));
> ERROR: No such function 'money' with the specified attributes
> test=> insert into t values (cash(3.33));
> ERROR: No such function 'cash' with the specified attributes
> test=> insert into t values (3.33);
> ERROR: Attribute 'x' is of type 'money' but expression is of type 'float8'
> You will need to rewrite or cast the expression
> test=> insert into t values ('3.33');
> INSERT 18569 1
> test=> select int(x) from t;
> ERROR: No such function 'int' with the specified attributes
> test=> select int4(x) from t;
> ERROR: No such function 'int4' with the specified attributes
>
> --
> Bruce Momjian | http://www.op.net/~candle
> maillist(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
> + If your life is a hard drive, | 830 Blythe Avenue
> + Christ can be your backup. | Drexel Hill, Pennsylvania 19026
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 1999-06-22 17:40:09 money data type and conversions
Previous Message Thomas Lockhart 1999-06-22 15:18:44 Re: [HACKERS] has anybody else used r-tree indexes in 6.5?