Re: problem comparing strings when different cluster / database encoding

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Tomas Vondra <tv(at)fuzzy(dot)cz>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: problem comparing strings when different cluster / database encoding
Date: 2006-04-05 23:03:16
Message-ID: 20060405230316.GE13673@surnet.cl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Tomas Vondra wrote:

Hi,

> I've encountered a strange problem. We have a PG 8.0.x database cluster
> (in the sense used in initdb, i.e. bunch of databases) created with
> UNICODE encoding, namely cs_CZ.UTF-8 locale.
>
> When a database is created with a different encoding (in our case it's
> LATIN2) the string comparison doesn't work correctly.

Actually this is sort of expected. Your locale configuration expects a
certain encoding; all databases should be created using that encoding
for string comparison to work properly. What definitely is a bug is the
fact that CREATE DATABASE allows you to create a database with an
encoding different from the one defined by initdb.

The conclusion is that you should create your databases using UTF-8
encoding if you are using cs_CZ.UTF-8, otherwise it won't work as
expected.

--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Eugene E. 2006-04-06 05:07:19 Re: have you feel anything when you read this ?
Previous Message Tom Lane 2006-04-05 22:39:24 Re: problem comparing strings when different cluster / database encoding