gpt4 book ai didi

postgresql - postgreSQL 中对 utf-8 的 LC_COLLATE 和 LC_CTYPE 支持

转载 作者:行者123 更新时间:2023-11-29 11:09:15 26 4
gpt4 key购买 nike

来自此链接 http://wiki.postgresql.org/wiki/Todo:Collatehttp://www.postgresql.org/docs/9.1/static/collation.html .这让我很困惑。

他们说,utf-8 支持取决于操作系统的能力,以及它在每个 LC_COLLATELC_CTYPE 选项之间的差异。

当我使用 pdAdmin III 创建数据库时,有 3 个选项,C、Posix 和 English_United States.1252C、Posix 和 English_United States.1252 之间有什么区别?

我想使用所有受支持的语言,即 unicode utf-8,这似乎不是一个选项。

我必须选择 LC_COLLATELC_CTYPE 的值才能在 PostgreSQL 9< 中创建支持 utf-8 的数据库?

最佳答案

作为文档,22.2. Character Set Support说:

An important restriction, however, is that each database's character set must be compatible with the database's LC_CTYPE (character classification) and LC_COLLATE (string sort order) locale settings. For C or POSIX locale, any character set is allowed, but for other locales there is only one character set that will work correctly. (On Windows, however, UTF-8 encoding can be used with any locale.)

我看到您可能在 Windows 主机(English_United States.1252 locale)下安装了 PostgreSQL,因此您可以使用其中的任何一个(Posix 相同>C 表示“无语言环境”),阅读 22.1. Locale Support :

Locale support refers to an application respecting cultural preferences regarding alphabets, sorting, number formatting, etc.

If you want the system to behave as if it had no locale support, use the special locale C or POSIX.

编辑:

Windows 平台不兼容 POSIX,因此您应该为该平台使用 C 语言环境。我不知道为什么安装程序有 POSIX 选项(我猜这是一个错误):

enter image description here

要创建没有语言环境的新集群,您可以简单地使用 --no-locale 开关,例如:

initdb --no-locale -E UTF-8 C:\pgdata

关于postgresql - postgreSQL 中对 utf-8 的 LC_COLLATE 和 LC_CTYPE 支持,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6579621/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com