Man*_*eep 12 postgresql postgresql-8.4
如何将Collation,cType更改为 - en_INfromen_US.UTF-8
List of databases
Name | Owner | Encoding | Collation | Ctype | Access privileges
-----------+----------+----------+-------------+-------------+-----------------------
postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
template0 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres
: postgres=CTc/postgres
template1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres
: postgres=CTc/postgres
Run Code Online (Sandbox Code Playgroud)
我当前的postgresversion是8.4我用它安装它
sudo apt-get install postgresql-8.4 postgresql-contrib-8.4
Run Code Online (Sandbox Code Playgroud)
我在我的ubuntu亚马逊服务器ec2中这样做
Chr*_*ers 10
我的建议:
拿一个pg_dumpall
重新初始化数据库集群,确保区域设置信息正确
恢复转储.
我发现有时可能需要使用模板template0(来自bash或WITH TEMPLATE template0psql的-T template0)创建一个db 来使用非init-db语言环境.
小智 8
我不得不更改为 POSIX.UTF-8。我使用以下命令进行了管理:
su postgres
psql
\l
update pg_database set datcollate='POSIX.UTF-8', datctype='POSIX.UTF-8' where datname='databasename';
\l
Run Code Online (Sandbox Code Playgroud)
不必重新创建整个数据库集群。但是,您需要重新创建数据库。
使用以下选项(man createdb)运行createdb :
-E encoding, --encoding=encoding
Specifies the character encoding scheme to be used in this
database. The character sets supported by the PostgreSQL server
are described in Section 22.3.1, “Supported Character Sets”, in
the documentation.
-l locale, --locale=locale
Specifies the locale to be used in this database. This is
equivalent to specifying both --lc-collate and --lc-ctype.
--lc-collate=locale
Specifies the LC_COLLATE setting to be used in this database.
--lc-ctype=locale
Specifies the LC_CTYPE setting to be used in this database.
Run Code Online (Sandbox Code Playgroud)
看来您真的无法更改现有数据库的排序规则:
=> ALTER DATABASE dbname SET "Collate" To Russian;
ERROR: unrecognized configuration parameter "Collate"
Run Code Online (Sandbox Code Playgroud)
请注意,您可以为表或列设置排序规则,请参见有关PostgreSQL中排序规则的良好教程。
| 归档时间: |
|
| 查看次数: |
31892 次 |
| 最近记录: |