Linux上的PostgreSQL 10-LC_COLLATE语言环境en_US.utf-8无效 [英] PostgreSQL 10 on Linux - LC_COLLATE locale en_US.utf-8 not valid
问题描述
错误:无效的语言环境名称: en_US.utf-8
ERROR: invalid locale name: "en_US.utf-8"
正在运行Ubuntu服务器18.04 Beta 2 with PostgreSQL 10。
Running Ubuntu server 18.04 Beta 2 with PostgreSQL 10.
在运行适用于9.5的数据库创建脚本时,我现在看到'en_US.UTF-8'作为语言环境的问题:
In running a database creation script that worked on 9.5, I am now seeing an issue with 'en_US.UTF-8' as a locale:
CREATE DATABASE db WITH TEMPLATE = template0 ENCODING = 'UTF8' LC_COLLATE = 'en_US.UTF-8' LC_CTYPE = 'en_US.UTF-8';
我知道这可能是多余的,因为我知道默认值是 en_US.etf-8。删除LC_COLLATE和LC_CTYPE参数使我可以运行脚本。
I know this may be redundant as I understand the default to be 'en_US.etf-8'. Removing the LC_COLLATE and LC_CTYPE parameters let me run my script.
那么,语言环境定义是否对V 10有所改变?还是现在正在发生其他事情?我在Postgres 10手册中找不到任何内容。
So did the locale definitions change somehow for V 10? Or is there something else now happening? I couldn't find anything on this in the Postgres 10 manual.
推荐答案
使用检查可用的语言环境locale -a
(如果未找到),尝试手动添加:
check for available locales with locale -a
if not found, try manually adding it with:
locale-gen en_US.UTF-8
在此之后
CREATE DATABASE db WITH TEMPLATE = template0 ENCODING = 'UTF8' LC_COLLATE = 'en_US.UTF-8' LC_CTYPE = 'en_US.UTF-8';
应该工作
这篇关于Linux上的PostgreSQL 10-LC_COLLATE语言环境en_US.utf-8无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!