更改LC_CTYPE以使用PostgreSQL和PostGIS

a.m*_*.m. 19 postgresql locale postgis geodjango

所以我正在浏览GeoDjango教程并且我坚持这个错误消息:

postgres@lucid32:~$ createdb -E UTF8 template_postgis
createdb: database creation failed: ERROR:  encoding UTF8 does not match locale en_US
DETAIL:  The chosen LC_CTYPE setting requires encoding LATIN1.
Run Code Online (Sandbox Code Playgroud)

我用Google搜索并阅读了一些Ubuntu文档,但无济于事.任何见解将不胜感激!

我正在使用默认的Vagrant Box清晰32,用于测试我的设置.

Pet*_*aut 13

最好只指定数据库的语言环境,并从中计算出编码.所以使用类似的东西

createdb --locale=en_US.utf8 template_postgis
Run Code Online (Sandbox Code Playgroud)

  • 我实际上最终做的是创建了-E UTF8 -T template0 --locale = en_US.utf8 template_postgis (13认同)

arc*_*hie 9

-E UTF8和--locale = en_US.utf8都是必需的

$ createdb -E UTF8 -T template0 --locale=en_US.utf8 template_postgis
Run Code Online (Sandbox Code Playgroud)


Fre*_*cer 5

否则,请在登录 postgresql 时尝试此操作:

create database databse_name with owner database_owner encoding='UTF-8'lc_collate='en_US.utf8' lc_ctype='en_US.utf8' template template0;
Run Code Online (Sandbox Code Playgroud)