LoginSignup
3
3

More than 5 years have passed since last update.

postgresでEncodingがEUC_JPのデータベースを作る

Posted at

どうも過去に何回もやったことがあるようだが忘れていていつも調べ直しているのでメモ。

postgresのバージョンが上がったからなのかもしれない。
シェルから

createdb -E EUC_JP my_db

というようにやると

createdb: database creation failed: ERROR:  encoding "EUC_JP" does not match locale "ja_JP.UTF-8"
DETAIL:  The chosen LC_CTYPE setting requires encoding "UTF8".

というように怒られる。

なので一旦psqlで入って、

psql
Password:
psql (9.6.3, server 9.4.1)
Type "help" for help.

myname=# CREATE DATABASE "my_db" WITH TEMPLATE="template0" ENCODING='EUC_JP' LC_COLLATE='C' LC_CTYPE='C';

とするといい。

参考:

3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3