template1
私たちの postgres 本番データベース サーバーには、テンプレート データベースから生まれた crd_production というデータベースがあります。ちなみに、Ubuntu 12.04 ボックスでは、pgcluster の初期作成時の template1 および template0 データベースのデフォルト エンコーディングは、LATIN1 のデフォルト エンコーディングでした。以下に示すように、私はデータベースを削除template1
し、utf-8 エンコーディングで新たに作成しました。
Name | Owner | Encoding | Collate | Ctype | Access privileges
----------------+----------+----------+------------+------------+-----------------------
crd_production | deployer | UTF8 | en_US.utf8 | en_US.utf8 |
postgres | postgres | UTF8 | en_US.utf8 | en_US.utf8 |
template0 | postgres | LATIN1 | en_US | en_US | =c/postgres +
| | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | en_US.utf8 | en_US.utf8 |
(4 rows)
最終的に rails(3.2.11) アプリをデプロイし、crd_production
db をプライマリ データベースとして使用し始めました。ActiveRecord がデータの書き込み/読み取りを行っている場合は問題ありませんがpsql
、このデータベースのコマンド ラインから SQL クエリを起動しようとすると、次のエラーが発生します -
crd_production=# select * from users;
ERROR: character with byte sequence 0xe2 0x80 0x9c in encoding "UTF8" has no equivalent in encoding "LATIN1"
crd_production=# select * from features;
ERROR: character with byte sequence 0xe2 0x80 0x99 in encoding "UTF8" has no equivalent in encoding "LATIN1"
ここで何が問題になる可能性がありますか?クライアント側の問題ですか?