A pgAdmin user has just pointed out that the data editor doesn't work with money columns, apparently because it casts
datawhen inserting/updating it. The docs for money say:
The money type stores a currency amount with a fixed fractional precision; see Table 8-3. Input is accepted in a
varietyof formats, including integer and floating-point literals, as well as "typical" currency formatting, such as
'$1,000.00'.Output is generally in the latter form but depends on the locale.
Yet:
-- Executing query:
select 123.45::money
ERROR: cannot cast type numeric to money
SQL state: 42846
-- Executing query:
select $123.45::money
ERROR: syntax error at or near ".45"
SQL state: 42601
Character: 12
-- Executing query:
select '$123.45'::money
ERROR: invalid input syntax for type money: "$123.45"
SQL state: 22P02
-- Executing query:
select '£123.00'::money
ERROR: invalid input syntax for type money: "£123.00"
SQL state: 22P02
-- Executing query:
select '123.45'::money
Total query runtime: 0 ms.
[this one returns an empty value]
So my question is, how do we cast input to the money type? Or am I working too late again and being a plank?
Regards, Dave.