ポストグレスでデータベースの文字コードを指定するには?

ショコラ
ショコラ

ポストグレスでデータベースの文字コードを指定するには?

「createdb {データベース名}–encoding={エンコーディング} –template=template0」でキメマス。

もっさん先輩
もっさん先輩
createdb {データベース名}--encoding={エンコーディング} --template=template0

「–template=template0」を指定しないと、↓こちらのエラーになります。

$ createdb testdb --encoding=UTF8
createdb: database creation failed: ERROR:  new encoding (UTF8) is incompatible with the encoding of the template database (EUC_JP)
HINT:  Use the same encoding as in the template database, or use template0 as template.

シチュエーション

「initdb –encoding=EUC-JP」で初期化したところに、Encoding UTF8 のデータベースを作成しようとしたところエラーになってしまった。

Scroll to Top