问题
How do I set lc_monetary
to show money
(docs) data type as EUR?
I tried:
- change
postgresql.conf
and setlc_monetary="de_DE.UTF-8@euro
. PG will not start with this change (currently set toen_US.UTF-8
) - do the same through pgAdmin and psql (using
set
) and I getERROR: invalid value for parameter "lc_monetary"
My current collation is en_US.UTF-8
.
回答1:
Locales depend on the operating system. Check what locales are available
select *
from pg_collation
where collname ~ any(array['DE', 'FR', 'GR', 'IE'])
collname | collnamespace | collowner | collencoding | collcollate | collctype
------------+---------------+-----------+--------------+-------------+------------
en_IE | 11 | 10 | 6 | en_IE.utf8 | en_IE.utf8
en_IE.utf8 | 11 | 10 | 6 | en_IE.utf8 | en_IE.utf8
(2 rows)
Well, my Ubuntu does not speak German, French nor Greek but the Irish speak English and pay in euro.
set lc_monetary to "en_IE.utf8";
select 10::money;
money
--------
€10.00
(1 row)
In Windows it is likely that the comp speaks German:
set lc_monetary to "de-DE";
Unfortunately, pg_collation
does not show this.
来源:https://stackoverflow.com/questions/54064945/set-lc-monetary-for-postgresql