postgresql中关于国际字符的lower()函数 [英] The lower() function on international characters in postgresql
问题描述
我有一个来自新旧ubuntu存储库的标准postgresql服务器。
I have a standard postgresql server from a new and an old ubuntu repository.
第一个是postgresql服务器8.3.12。在这里,lower()函数可以正确处理丹麦字母Æ
The first is postgresql server 8.3.12. Here the lower() function works correctly on the Danish letter 'Æ'
go=# select lower('Æ');
lower
-------
æ
(1 row)
现在在postgres 9.1.9上,该功能不起作用(返回相同的大写字母)
Now on postgres 9.1.9 the function doesn't work (it returns the same uppercase letter)
go=# select lower('Æ');
lower
-------
Æ
(1 row)
有人知道如何更改此行为吗?
Does anyone have an idea how to change this behavior?
(我的真正问题是,我不喜欢丹麦语字符,但是我认为上面的示例会使问题更清楚)
(my real problem is that ilike doesn't work on Danish characters either, but I thought the above example would make the problem more clear)
推荐答案
您的数据库可能是使用其他语言环境创建的。
Your database was probably created with a different locale.
在新旧版本的 psql
中检查 \l +
版本。它们将具有不同的语言环境设置。
Check \l+
in psql
on the old and new versions. They'll have different locale settings.
其他可能性是不同的操作系统/版本。 PostgreSQL使用libc的语言环境规则,并且某些平台(尤其是Mac OS X)具有一些...特殊的... libc。
Other possibilities are different operating systems/versions. PostgreSQL uses libc's locale rules, and some platforms (notably Mac OS X) have a bit of a ... special ... libc.
在9.1.9中,在Fedora 19上运行的 en_AU.UTF-8
数据库我得到:
On 9.1.9 with an en_AU.UTF-8
database running on Fedora 19 I get:
regress=> select lower('Æ');
lower
-------
æ
(1 row)
这篇关于postgresql中关于国际字符的lower()函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!