Re: problem comparing strings when different cluster / database encoding - Mailing list pgsql-sql

From Alvaro Herrera
Subject Re: problem comparing strings when different cluster / database encoding
Date
Msg-id 20060405230316.GE13673@surnet.cl
Whole thread Raw
In response to problem comparing strings when different cluster / database encoding  (Tomas Vondra <tv@fuzzy.cz>)
List 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


pgsql-sql by date:

Previous
From: Tom Lane
Date:
Subject: Re: problem comparing strings when different cluster / database encoding
Next
From: "Eugene E."
Date:
Subject: Re: have you feel anything when you read this ?