php – 在PostgreSQL中,语言环境设置LC_NUMERIC如何工作?

任何人都可以深入了解Postgresql中的语言环境和数字类型行为吗?我们与意大利语语言环境合作.这是小数部分的逗号分隔.在postgresql.conf中设置

# These settings are initialized by initdb, but they can be changed.
lc_messages = 'it_IT.UTF-8'                     # locale for system error message
                                                # strings
lc_monetary = 'it_IT.UTF-8'                     # locale for monetary formatting
lc_numeric = 'it_IT.UTF-8'                      # locale for number formatting
lc_time = 'it_IT.UTF-8'                         # locale for time formatting

.. 什么也没做!它以一种非常合适的方式表现日期,因此,但数字类型仍为小数部分分开DOT.

root@server:~# uname -a
Linux server 2.6.32-36-generic-pae #79-Ubuntu SMP Tue Nov 8 23:25:26 UTC 2011 i686 GNU/Linux

root@server:~# dpkg -l | grep postgresql
ii  postgresql-8.4      8.4.9-0ubuntu0.10.04   object-relational sql database, version 8.4 
ii  postgresql-client   8.4.9-0ubuntu0.10.04   front-end programs for Postgresql (supported)

编辑

在不同范围内实现locale有问题:db,server script,os和client side.决定避免任何区域设置格式并使用en_EN语言环境.区域设置格式仅在输出时应用.

解决方法:

我引用manual

lc_numeric (string)

Sets the locale to use for formatting numbers, for example with the to_char family of functions.

关注这些type formatting functions.您应该能够重现以下演示:

SHOW lc_numeric;

de_AT.UTF-8

SELECT to_number('13,4','999D99')

13.4

SELECT to_char(13.4,'FM999D99')

13,4

SET lc_numeric = 'C';
SELECT to_number('13,4','999D99')

134

SELECT to_char(13.4,'FM999D99')

13.4

RESET lc_numeric;

Template patterns in the manual.

sql表达式中的数字格式不会随语言环境设置而改变.那将是疯狂的.

另请注意:您知道在更改postgresql.conf之后必须(至少)重新加载服务器.

pg_ctl reload

相关文章

项目需要,有个数据需要导入,拿到手一开始以为是mysql,结果...
本文小编为大家详细介绍“怎么查看PostgreSQL数据库中所有表...
错误现象问题原因这是在远程连接时pg_hba.conf文件没有配置正...
因本地资源有限,在公共测试环境搭建了PGsql环境,从数据库本...
wamp 环境 这个提示就是说你的版本低于10了。 先打印ph...
psycopg2.OperationalError: SSL SYSCALL error: EOF detect...