PostgreSQL 安装问题字符类型
PostgreSQL installation issue Character Type
我安装了带有默认数据库 postgres 的 PostgreSQL 9.2。
它将排序规则和字符类型显示为 en_GB.UTF-8.
en_GB和en_US有区别吗?不卸载可以改成en_US吗
第一个选项是在创建新数据库时,您可以提供 Collation 和 Ctype,例如
postgres=# CREATE DATABASE test WITH LC_COLLATE='en_US' Encoding='LATIN1' lc_ctype='en_US' TEMPLATE=template0;;
CREATE DATABASE
postgres=# \l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------+----------+----------+-------------+-------------+-----------------------
postgres | postgres | UTF8 | en_GB.UTF-8 | en_GB.UTF-8 |
template0 | postgres | UTF8 | en_GB.UTF-8 | en_GB.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | en_GB.UTF-8 | en_GB.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
test | postgres | LATIN1 | en_US | en_US |
(4 rows)
第二个选项是执行全新的 initdb 并提供 -E 编码和 --locale=locale。设置数据库集群的默认语言环境。如果不指定该选项,locale继承自initdb运行的环境
中使用 --locale 查看有关 initdb 的更多详细信息
披露:我为 EnterpriseDB (EDB)
工作
我安装了带有默认数据库 postgres 的 PostgreSQL 9.2。 它将排序规则和字符类型显示为 en_GB.UTF-8.
en_GB和en_US有区别吗?不卸载可以改成en_US吗
第一个选项是在创建新数据库时,您可以提供 Collation 和 Ctype,例如
postgres=# CREATE DATABASE test WITH LC_COLLATE='en_US' Encoding='LATIN1' lc_ctype='en_US' TEMPLATE=template0;;
CREATE DATABASE
postgres=# \l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------+----------+----------+-------------+-------------+-----------------------
postgres | postgres | UTF8 | en_GB.UTF-8 | en_GB.UTF-8 |
template0 | postgres | UTF8 | en_GB.UTF-8 | en_GB.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | en_GB.UTF-8 | en_GB.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
test | postgres | LATIN1 | en_US | en_US |
(4 rows)
第二个选项是执行全新的 initdb 并提供 -E 编码和 --locale=locale。设置数据库集群的默认语言环境。如果不指定该选项,locale继承自initdb运行的环境
中使用 --locale 查看有关 initdb 的更多详细信息披露:我为 EnterpriseDB (EDB)
工作