failing to make LATIN1 on locale C system - what am I doing wrong?

From: marc rassbach <unixwisard(at)gmail(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: failing to make LATIN1 on locale C system - what am I doing wrong?
Date: 2016-06-26 22:55:31
Message-ID: CAPaK5U9VK0SCbV5biK7GGha3CiKEyF5kTHutPz2V1NqwBDQcyA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Trying to do what maia mailguard says:
http://www.maiamailguard.com/maia/wiki/Install
"NOTE: Newer versions of PostgreSQL use UTF8 encoding by default, which is
not supported by all of the tools that Maia requires. To avoid encoding
errors, PostgreSQL users should use:
pgsql> CREATE DATABASE maia WITH ENCODING 'LATIN1';"

The most popular web-based answer is variations on 'nuke template0 and pick
LATIN1'

Yet the postgresql documentation says:
https://www.postgresql.org/docs/9.4/static/sql-createdatabase.html
"The character set encoding specified for the new database must be
compatible with the chosen locale settings (LC_COLLATE and LC_CTYPE). If
the locale is C (or equivalently POSIX), then all encodings are allowed,"

So what am I missing when I do the below and it doesn't work?

$ psql template1
psql (9.4.7)
Type "help" for help.

template1=# CREATE DATABASE music ENCODING 'LATIN1' TEMPLATE template0;
ERROR: encoding "LATIN1" does not match locale "en_US.UTF-8"
DETAIL: The chosen LC_CTYPE setting requires encoding "UTF8".
template1-# \q
$ locale
LANG=
LC_CTYPE="C"
LC_COLLATE="C"
LC_TIME="C"
LC_NUMERIC="C"
LC_MONETARY="C"
LC_MESSAGES="C"
LC_ALL=
$ whoami
pgsql

And it "works fine" if I don't try latin1:

$ psql template1
psql (9.4.7)
Type "help" for help.

template1=# CREATE DATABASE music ENCODING 'UTF8' TEMPLATE template0;
CREATE DATABASE
template1=# drop database music;
DROP DATABASE
template1=# \q
$

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Albe Laurenz 2016-06-27 07:46:24 Re: failing to make LATIN1 on locale C system - what am I doing wrong?
Previous Message Sameer Kumar 2016-06-24 01:23:32 Re: What Causes Access Exclusive Lock?