postgresql中关于国际字符的lower()函数

编程入门 行业动态 更新时间:2024-10-28 16:18:26
本文介绍了postgresql中关于国际字符的lower()函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个来自新旧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()函数

本文发布于:2023-10-16 11:19:18,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1497406.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:函数   字符   国际   postgresql

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!