> The following query works:
> brett=> select '1'::money * 2;
> but this one doesn't:
> brett=> select sum('1'::money) * 2
> with the following error:
> ERROR: There is no operator '*' for types 'money' and 'money'
> bug?
Feature, until we fix it :)
I'm working on automatic type conversion for v6.4, and your specific
example already works in my preliminary code:
tgl=> select sum('$1.00'::money) * 2;
--------
$2.00
(1 row)
And even:
tgl=> select sum('$1.00'::money) * 2.5;
--------
$2.50
(1 row)
> Also, are there any plans to remove the dollar sign from the money
> type? Or are we just going to use integers with precision. How do I
> create a table with integers that only output the first two decimal
> places?
We don't yet have exact numerics with a scale other than zero (a
standard integer). We need to get an implementation with either a BCD
package, or 64-bit integers, or the GNU extended-precision math package,
or ?? to enable arbitrary range integers with scale. We also probably
need some work on the backend to pass along extended information for
these kinds of types (e.g. the precision and scale defined for a target
column).
- Tom