Re: [HACKERS] money or dollar type

Поиск
Список
Период
Сортировка
От Jose' Soares Da Silva
Тема Re: [HACKERS] money or dollar type
Дата
Msg-id Pine.LNX.3.96.980512100647.424A-100000@proxy.bazzanese.com
обсуждение исходный текст
Ответ на Re: [HACKERS] money or dollar type  ("Thomas G. Lockhart" <lockhart@alumni.caltech.edu>)
Список 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'


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

Предыдущее
От: Andreas Zeugswetter
Дата:
Сообщение: AW: [HACKERS] Re: [QUESTIONS] money or dollar type
Следующее
От: Andreas Zeugswetter
Дата:
Сообщение: AW: [HACKERS] questionable codes in libpq/backend communication