linux - How to set encoding to PostgreSQL data base? -
i cant see cyrillic symbols in postgresql 9.1 on linux mint. want create new bd cyrillic encoding. says:
create database ekb_1 encoding 'cp1251' template postgistemplate;
but error:
postgres=# create database ekb_1 encoding 'win1251' template postgistemplate; error: encoding win1251 not match locale ru_ru.utf-8 ПОДРОБНОСТИ: chosen lc_ctype setting requires encoding utf8.
i try add lc_type 'ru_ru.win1251'
not help.
whats wrong?
this work this:
create database dbname encoding 'win1251' lc_ctype='ru_ru.cp1251' lc_collate='ru_ru.cp1251' template template0;
if ru_ru.cp1251
locale doesn't exist, create sudo locale-gen ru_ru.cp1251
(ubuntu-style, assume mint similar in regard) , restart postgres (it doesn't pick new locales dynamically, , error message confusing).
the postgistemplate
db accepted template if has same encoding, unlikely given context. presumably it's in utf-8
.
in case, there 2 options in theory, not sure if practical:
- create database
template0
mentioned in command above, , play postgis initialization script inside it. - recreate
postgistemplate
database inwin1251
encoding assuming it's supported postgis.
personally, i'd try solve problems utf-8 led try different encoding in first place, , stay encoding.
Comments
Post a Comment