Re: [HACKERS] money or dollar type

From: "Jose' Soares Da Silva" <sferac(at)bo(dot)nettuno(dot)it>
To: "Thomas G(dot) Lockhart" <lockhart(at)alumni(dot)caltech(dot)edu>
Cc: hackers postgres <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [HACKERS] money or dollar type
Date: 1998-05-12 10:07:53
Message-ID: Pine.LNX.3.96.980512100647.424A-100000@proxy.bazzanese.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, 11 May 1998, Thomas G. Lockhart wrote:

> > I think that PostgreSQL money type should be very useful if we could
> > remove the dollar sign. We can't use it with Lira/Peseta/Mark etc.
> > In europe now we have Euro. If we remove the $ it will be useful
> > otherwise we have to rename it to 'dollar'. ;-)
>
> Have you tried compiling with "USE_LOCALE" turned on and with the right
> setting for LC_xxx? The code is supposed to use local conventions, but I
> don't know if it works in the way you want. I agree that it should...
>
> > PS: Is there a reason to left justify it ?
>
> That is just an artifact of the column formatting; all columns are left
> justified in psql afaik.
>

Seems there's some problems with type 'money'... I can't multiply or
divide 'money' types, and can't cast it properly to other data types.

prova=> select ename,job,hiredate, sal from employees;
ename |job | hiredate|sal
------+----------+----------+---------
ALLEN |SALESMAN |1981-02-20|$1,600.00
BLAKE |MANAGER |1981-05-01|$2,850.00
JONES |CLERK |1981-12-03|$950.00
MILLER|SALESMAN |1981-09-28|$1,250.00
CLARK |SALESMAN |1981-09-08|$1,500.00
KING |SALESMAN |1981-02-22|$1,250.00
(6 rows)

prova=> select ename,job,hiredate, sal*1.1 as dream from employees;
ERROR: There is no operator '*' for types 'money' and 'money'
You will either have to retype this query using an explicit cast,
or you will have to define the operator using CREATE OPERATOR

prova=> select ename,job,hiredate,sal, sal::float as dream from employees;
ename |job | hiredate|sal | dream
------+----------+----------+---------+----------
ALLEN |SALESMAN |1981-02-20|$1,600.00|1079143604
BLAKE |MANAGER |1981-05-01|$2,850.00|1079143508
JONES |CLERK |1981-12-03|$950.00 |1079143412
MILLER|SALESMAN |1981-09-28|$1,250.00|1079143316
CLARK |SALESMAN |1981-09-08|$1,500.00|1079143220
KING |SALESMAN |1981-02-22|$1,250.00|1079143120
(6 rows)

Is this a bug ?
Jose'

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andy Farrell 1998-05-12 10:18:08 Box operation algorithms
Previous Message Olaf Mittelstaedt 1998-05-12 08:50:22 Re: NEW ODBC DRIVER