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

From Albe Laurenz
Subject Re: failing to make LATIN1 on locale C system - what am I doing wrong?
Date
Msg-id A737B7A37273E048B164557ADEF4A58B53866F98@ntex2010i.host.magwien.gv.at
Whole thread Raw
In response to failing to make LATIN1 on locale C system - what am I doing wrong?  (marc rassbach <unixwisard@gmail.com>)
Responses Re: failing to make LATIN1 on locale C system - what am I doing wrong?  (marc rassbach <unixwisard@gmail.com>)
List 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

pgsql-novice by date:

Previous
From: marc rassbach
Date:
Subject: failing to make LATIN1 on locale C system - what am I doing wrong?
Next
From: marc rassbach
Date:
Subject: Re: failing to make LATIN1 on locale C system - what am I doing wrong?