5

How do I set lc_monetary to show money (docs) data type as EUR?

I tried:

  • change postgresql.conf and set lc_monetary="de_DE.UTF-8@euro. PG will not start with this change (currently set to en_US.UTF-8)
  • do the same through pgAdmin and psql (using set) and I get ERROR: invalid value for parameter "lc_monetary"

My current collation is en_US.UTF-8.

Tomas Greif
  • 21,685
  • 23
  • 106
  • 155

1 Answers1

5

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.

klin
  • 112,967
  • 15
  • 204
  • 232
  • not working for me: though I'm seeing el-GR in pg_collation, trying to set lc_monetary to "el-GR" is still giving me the ERROR invalid value for parameter "lc_monetary": "el-GR" – manos Nov 19 '20 at 08:24