From: | "Dave Page" <dpage(at)vale-housing(dot)co(dot)uk> |
---|---|
To: | "PostgreSQL Hackers" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Casting to money |
Date: | 2006-10-08 20:36:14 |
Message-ID: | E7F85A1B5FF8D44C8A1AF6885BC9A0E40176D38D@ratbert.vale-housing.co.uk |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
A pgAdmin user has just pointed out that the data editor doesn't work with money columns, apparently because it casts data when 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 variety of 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.
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2006-10-08 21:32:14 | Re: [COMMITTERS] pgsql: Add include needed for new |
Previous Message | Tom Lane | 2006-10-08 19:39:46 | Re: [PATCHES] Use non-deprecated APIs for dynloader/darwin.c |