问题描述
现在,我可以在pgAdmin4 GUI中创建新数据库时选择Encoding : UTF8
.
Right now I can choose Encoding : UTF8
when creating a new DB in pgAdmin4 GUI.
但是,没有选择utf8_general_ci
作为排序规则或字符类型的选项.当我执行select * from pg_collation;
时,没有看到与utf8_general_ci
相关的任何排序规则.
But, there is no option to choose utf8_general_ci
as collation or character type. When I do select * from pg_collation;
I dont see any collation relevant to utf8_general_ci
.
来自mySQL背景,我很困惑.我是否必须在PostgreSQL 10或Windows10中安装类似utf8的排序规则(例如utf8_general_ci
,utf8_unicode_ci
)?
Coming from a mySQL background I am confused. Do I have to install utf8-like ( eg utf8_general_ci
, utf8_unicode_ci
) collation in my PostgreSQL 10 or windows10?
我只想将mySQL collation utf8_general_ci
等同于PostgreSQL.
I just want to have the equivalent of mySQL collation utf8_general_ci
to PostgreSQL.
谢谢
推荐答案
utf8
是一种编码(如何将unicode字符表示为一系列字节),而不是归类(哪个字符在哪个字符之前).
utf8
is an encoding (how to represent unicode characters as a series of bytes), not a collation (which character goes before which).
我认为与utf8_general_ci
(或更现代的utf8_unicode_ci
)相对应的Postgres 10归类称为und-x-icu
-这是ICU库提供的未定义归类(未为任何现实世界语言定义).这种排序规则可以对大多数语言中的字符进行合理排序.
I think the Postgres 10 collation equivalent for utf8_general_ci
(or more modern utf8_unicode_ci
) is called und-x-icu
- this is an undefined collation (not defined for any real world language) provided by an ICU library. This collation would sort quite reasonably characters from most languages.
ICU支持是PostgreSQL 10中新增的新功能,因此该排序规则不适用于较早的PostgreSQL版本或在编译过程中被禁用时.在此之前,Postgres使用的是操作系统提供的归类支持,这在各个操作系统之间是不同的.
ICU support is a new feature added in PostgreSQL 10, so this collation isn't available for older PostgreSQL versions or when it's disabled during compilation. Before that Postgres was using operating system provided collation support, which differs between operating systems.
这篇关于在PostgreSQL中安装utf8归类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!