回答編集履歴

1

コメントを受けての追記#1

2016/09/05 06:08

投稿

takyafumin
takyafumin

スコア2335

test CHANGED
@@ -9,3 +9,113 @@
9
9
  未検証ですが、DB再構築が可能であれば、上記手順で改善できますでしょうか。
10
10
 
11
11
  一度vmwareなど仮想環境での事前検証にて改善できることを確認したのち、VPSでの実施をオススメします。
12
+
13
+
14
+
15
+ ---
16
+
17
+
18
+
19
+ ### コメントを受けての追記#1
20
+
21
+
22
+
23
+ 手元の仮想環境で検証しましたが、再現しました。
24
+
25
+ - ubuntu 16.04
26
+
27
+ - postgresql 9.5
28
+
29
+
30
+
31
+ createdbする際に、template0を基としてLANG, ENCODEを指定すると正しくUTF8のデータベースが作成できました。(クラスタが存在する状態で、createdb)
32
+
33
+
34
+
35
+ 現在、クラスタが削除されている状態であれば、postgresqlの再インストール後(クラスタが再生成される)に、お試しください。
36
+
37
+
38
+
39
+
40
+
41
+ ```bash
42
+
43
+
44
+
45
+ postgres=# \l
46
+
47
+ List of databases
48
+
49
+ Name | Owner | Encoding | Collate | Ctype | Access privileges
50
+
51
+ -----------+----------+----------+---------+-------+-----------------------
52
+
53
+ postgres | postgres | LATIN1 | en_US | en_US |
54
+
55
+ template0 | postgres | LATIN1 | en_US | en_US | =c/postgres +
56
+
57
+ | | | | | postgres=CTc/postgres
58
+
59
+ template1 | postgres | LATIN1 | en_US | en_US | =c/postgres +
60
+
61
+ | | | | | postgres=CTc/postgres
62
+
63
+ (3 rows)
64
+
65
+
66
+
67
+ postgres=# create user hoge with password 'hoge';
68
+
69
+ postgres=# \du
70
+
71
+ List of roles
72
+
73
+ Role name | Attributes | Member of
74
+
75
+ -----------+------------------------------------------------------------+-----------
76
+
77
+ hoge | | {}
78
+
79
+ postgres | Superuser, Create role, Create DB, Replication, Bypass RLS | {}
80
+
81
+
82
+
83
+ postgres=#
84
+
85
+ postgres=# \q
86
+
87
+
88
+
89
+ postgres@vagrant:~$ createdb -l C -T template0 -E UTF8 -O hoge hogedb
90
+
91
+ postgres@vagrant:~$ psql
92
+
93
+ psql (9.5.4)
94
+
95
+ Type "help" for help.
96
+
97
+
98
+
99
+ postgres=# \l
100
+
101
+ List of databases
102
+
103
+ Name | Owner | Encoding | Collate | Ctype | Access privileges
104
+
105
+ -----------+----------+----------+---------+-------+-----------------------
106
+
107
+ hogedb | hoge | UTF8 | C | C |
108
+
109
+ postgres | postgres | LATIN1 | en_US | en_US |
110
+
111
+ template0 | postgres | LATIN1 | en_US | en_US | =c/postgres +
112
+
113
+ | | | | | postgres=CTc/postgres
114
+
115
+ template1 | postgres | LATIN1 | en_US | en_US | =c/postgres +
116
+
117
+ | | | | | postgres=CTc/postgres
118
+
119
+ (4 rows)
120
+
121
+ ```