Money - Mailing list pgsql-general

From Bill Sneed
Subject Money
Date
Msg-id 3672E98E.B3C125F2@mint.net
Whole thread Raw
Responses Re: [GENERAL] Money
List pgsql-general
I' m trying to perform some simple arithmetic with a field datatype,
money.

For example, select part_id, cost from parts;  gives the id and cost
in dollars...
         select part_id, cost+1.00 from parts; ....adds $1.00 to
displayed cost.
         select part_id, cost*2 from parts; produces an error message...
"There is no operator '*' for types money.....retype this query  using
an explicit cast or.....define the operator using CREATE OPERATOR."

If I examine the list of operators using \do,  there are any number of
them shown for *, money, int2, float4, etc.

Question 1:  Is this a list of existing oeprators or a list of
permitted ones that I have to create?

Question 2:  I can't figure out haw to use the CAST ::   ....Any
hints?

Again, TIA to one and all.

.......Bill Sneed....Prospect, Maine......


pgsql-general by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [GENERAL] PL/pgSQL
Next
From: Bruce Momjian
Date:
Subject: Re: [GENERAL] alter table ?