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

From: Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>
To: "'marc rassbach *EXTERN*'" <unixwisard(at)gmail(dot)com>, "pgsql-novice(at)postgresql(dot)org" <pgsql-novice(at)postgresql(dot)org>
Subject: Re: failing to make LATIN1 on locale C system - what am I doing wrong?
Date: 2016-06-27 07:46:24
Message-ID: A737B7A37273E048B164557ADEF4A58B53866F98@ntex2010i.host.magwien.gv.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

marc rassbach wrote:
> 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'

I don't understand what you mean by that ...

> 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

[...]

> 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

You should use:

CREATE DATABASE music TEMPLATE template0 LC_COLLATE="C" LC_CTYPE="C";

Yours,
Laurenz Albe

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message marc rassbach 2016-06-27 08:25:03 Re: failing to make LATIN1 on locale C system - what am I doing wrong?
Previous Message marc rassbach 2016-06-26 22:55:31 failing to make LATIN1 on locale C system - what am I doing wrong?