Обсуждение: Cannot create UTF-8 database

Поиск
Список
Период
Сортировка

Cannot create UTF-8 database

От
"Carlson, Jacob"
Дата:
Hello,

I am trying to create a UNICODE schema and am getting an error.  Is there a=
 configuration file I need to update to except Unicode schemas?  I am using=
 this version of software - postgresql-8.3.8-S10.i386-64.tar.
To note, I am able to create an ASCII encoded schema with no problem.

Unicode Error:

postgres=3D# create database "apt_utf8" with encoding =3D 'UNICODE';
ERROR:  encoding UTF8 does not match server's locale C
DETAIL:  The server's LC_CTYPE setting requires encoding LATIN1.

ASCII schema created:

postgres=3D# create database "apt_sql_ascii" with encoding =3D 'SQL_ASCII';
CREATE DATABASE


Thanks for any information.


Jacob Carlson
jacob.carlson@navteq.com<mailto:jacob.carlson@navteq.com>

NA Technical Operations Group
Work Phone 312-780-3040


The information contained in this communication may be CONFIDENTIAL and is =
intended only for the use of the recipient(s) named above.  If you are not =
the intended recipient, you are hereby notified that any dissemination, dis=
tribution, or copying of this communication, or any of its contents, is str=
ictly prohibited.  If you have received this communication in error, please=
 notify the sender and delete/destroy the original message and any copy of =
it from your computer or paper files.

Re: Cannot create UTF-8 database

От
Tom Lane
Дата:
"Carlson, Jacob" <jacob.carlson@navteq.com> writes:
> I am trying to create a UNICODE schema and am getting an error.  Is there a configuration file I need to update to
exceptUnicode schemas?  I am using this version of software - postgresql-8.3.8-S10.i386-64.tar. 
> To note, I am able to create an ASCII encoded schema with no problem.

Postgres tries to prevent you from selecting an incompatible combination
of locale and encoding.  In general, the locale support presumes a
specific character encoding for any given locale setting, so if you were
to set a database encoding different from that, you would get strange
misbehaviors in areas like text sorting, upper/lowercasing, etc.

> Unicode Error:

> postgres=# create database "apt_utf8" with encoding = 'UNICODE';
> ERROR:  encoding UTF8 does not match server's locale C
> DETAIL:  The server's LC_CTYPE setting requires encoding LATIN1.

Hm, that is odd.  C locale is normally considered encoding-agnostic
(because it doesn't do anything with characters outside the ASCII
range).  What platform is this on?

The short answer to your question is that you're going to need to
re-initdb with a utf8-compatible locale setting, but I'm just wondering
why it wouldn't let you do it in C locale ...

            regards, tom lane