Set lc_monetary for PostgreSQL

后端 未结 1 1426
自闭症患者
自闭症患者 2021-01-22 10:54

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

I tried:

  • change postgresql.conf and set lc_mo
1条回答
  •  遥遥无期
    2021-01-22 11:16

    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.

    0 讨论(0)
提交回复
热议问题