事象をググってみると、debian系OSで発生する事象のようですね。
Debian系でPostgreSQLのロケールを変更する
未検証ですが、DB再構築が可能であれば、上記手順で改善できますでしょうか。
一度vmwareなど仮想環境での事前検証にて改善できることを確認したのち、VPSでの実施をオススメします。
コメントを受けての追記#1
手元の仮想環境で検証しましたが、再現しました。
- ubuntu 16.04
- postgresql 9.5
createdbする際に、template0を基としてLANG, ENCODEを指定すると正しくUTF8のデータベースが作成できました。(クラスタが存在する状態で、createdb)
現在、クラスタが削除されている状態であれば、postgresqlの再インストール後(クラスタが再生成される)に、お試しください。
bash
1
2postgres=# \l
3 List of databases
4 Name | Owner | Encoding | Collate | Ctype | Access privileges
5-----------+----------+----------+---------+-------+-----------------------
6 postgres | postgres | LATIN1 | en_US | en_US |
7 template0 | postgres | LATIN1 | en_US | en_US | =c/postgres +
8 | | | | | postgres=CTc/postgres
9 template1 | postgres | LATIN1 | en_US | en_US | =c/postgres +
10 | | | | | postgres=CTc/postgres
11(3 rows)
12
13postgres=# create user hoge with password 'hoge';
14postgres=# \du
15 List of roles
16 Role name | Attributes | Member of
17-----------+------------------------------------------------------------+-----------
18 hoge | | {}
19 postgres | Superuser, Create role, Create DB, Replication, Bypass RLS | {}
20
21postgres=#
22postgres=# \q
23
24postgres@vagrant:~$ createdb -l C -T template0 -E UTF8 -O hoge hogedb
25postgres@vagrant:~$ psql
26psql (9.5.4)
27Type "help" for help.
28
29postgres=# \l
30 List of databases
31 Name | Owner | Encoding | Collate | Ctype | Access privileges
32-----------+----------+----------+---------+-------+-----------------------
33 hogedb | hoge | UTF8 | C | C |
34 postgres | postgres | LATIN1 | en_US | en_US |
35 template0 | postgres | LATIN1 | en_US | en_US | =c/postgres +
36 | | | | | postgres=CTc/postgres
37 template1 | postgres | LATIN1 | en_US | en_US | =c/postgres +
38 | | | | | postgres=CTc/postgres
39(4 rows)