小编Oğu*_*pçu的帖子

为 postgresql 数据库设置默认排序规则

我创建了一个带有土耳其语排序规则的数据库。

\n\n
createdb -l tr_TR test_tr -E LATIN5 -T template0\n
Run Code Online (Sandbox Code Playgroud)\n\n

然后是一张有一行的桌子。

\n\n
\\c test_tr    \ncreate table turkish(one text);\ninsert into turkish values(\'inci\');\n
Run Code Online (Sandbox Code Playgroud)\n\n

一切都在预料之中。

\n\n
test_tr=# \\l\n                                  List of databases\n    Name    |  Owner   | Encoding |   Collate   |    Ctype    |   Access privileges   \n------------+----------+----------+-------------+-------------+-----------------------\n test_tr    | postgres | LATIN5   | tr_TR       | tr_TR       | \n
Run Code Online (Sandbox Code Playgroud)\n\n

问题是,我期望 \xc4\xb0NC\xc4\xb0 但它给了我 INCI。这对于土耳其语来说是错误的。

\n\n
test_tr=# select upper("one") from turkish ;\n upper \n-------\n INCI\n(1 row)\n
Run Code Online (Sandbox Code Playgroud)\n\n

事实证明,默认排序规则仍然是英语。

\n\n
test_tr=# select upper("one" collate "tr_TR"),upper("one"), "one" from …
Run Code Online (Sandbox Code Playgroud)

postgresql collation

2
推荐指数
1
解决办法
1万
查看次数

标签 统计

collation ×1

postgresql ×1