PostgreSQL: CAST() as money: specify currency
I'm looking to specify the currency as GBP when casting as money in PSQL. Currently, this prefixes the formatted value as USD (with $):
SELECT CAST(SUM(cost) AS MONEY) AS Total FROM orders;
Gives:
Total | $13,266,314.00
Is there a nice way way to specify £
when casting to money instead of $
or will this require CONCAT()
, ROUND()
and TO_CHAR()
?
You may set lc_monetary in postgresql.conf, or within your sql client. Here is the latter test case:
set lc_monetary to "en_IE.utf8";
select 10::money;
money
--------
€10.00
(1 row)