collation、cTypeを-en_IN
からen_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
私の現在のpostgresversionは8.4です。
Sudo apt-get install postgresql-8.4 postgresql-contrib-8.4
私のubuntu Amazonサーバーec2でこれをやっています
私の推薦:
pg_dumpallを取る
ロケール情報が正しいことを確認して、dbクラスターを再初期化します。
ダンプを復元します。
Init-db以外のロケールを使用するために、テンプレートtemplate0(bashの-T template0またはpsqlのWITH TEMPLATE template0
)を使用してdbを作成しなければならない可能性があることを発見しました。
データベースクラスタ全体を再作成する必要はありません。ただし、データベースを再作成する必要があります。
これらのオプション(man 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.
既存のデータベースの照合を変更することは本当にできないようです:
=> ALTER DATABASE dbname SET "Collate" To Russian;
ERROR: unrecognized configuration parameter "Collate"
テーブルまたは列の照合順序を設定できることに注意してください。PostgreSQLの照合順序については、優れた tutorial を参照してください。