为PostgreSQL设置lc_monetary [英] Set lc_monetary for PostgreSQL

查看:974
本文介绍了为PostgreSQL设置lc_monetary的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何设置 lc_monetary 以显示 money docs )数据类型为EUR?

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

我尝试过:


  • 更改 postgresql.conf 并设置 lc_monetary = de_DE.UTF-8@euro 。PG不会以此更改开头(当前设置为 en_US.UTF-8

  • 通过pgAdmin和psql(使用 set )执行相同的操作,得到 ERROR:参数 lc_monetary的无效值

  • 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"

我当前的排序规则是 en_US.UTF-8

推荐答案

语言环境取决于操作系统。检查可用的语言环境

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)

嗯,我的Ubuntu不会说德语,法语

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)






在Windows中,很可能该比较器说德语:

set lc_monetary to "de-DE";

不幸的是, pg_collat​​ion 没有显示此内容。

Unfortunately, pg_collation does not show this.

这篇关于为PostgreSQL设置lc_monetary的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆