X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 1AE3611F655F for ; Wed, 5 Apr 2006 19:39:31 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 68251-02 for ; Wed, 5 Apr 2006 19:39:30 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id E63E811F6282 for ; Wed, 5 Apr 2006 19:39:27 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k35MdO2u012877; Wed, 5 Apr 2006 18:39:24 -0400 (EDT) To: Tomas Vondra cc: pgsql-sql@postgresql.org Subject: Re: problem comparing strings when different cluster / database encoding In-reply-to: <443444B5.1010205@fuzzy.cz> References: <443444B5.1010205@fuzzy.cz> Comments: In-reply-to Tomas Vondra message dated "Thu, 06 Apr 2006 00:29:09 +0200" Date: Wed, 05 Apr 2006 18:39:24 -0400 Message-ID: <12876.1144276764@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.114 required=5 tests=[AWL=0.114] X-Spam-Score: 0.114 X-Spam-Level: X-Archive-Number: 200604/29 X-Sequence-Number: 24838 Tomas Vondra writes: > 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. That's right. This doesn't work, and is warned against in our docs (at least in recent versions). You really must keep server_encoding matching the encoding the locale expects, for all except "trivial" locales such as C that have no encoding expectations. We'd forbid these combinations if there were any fully portable way to detect which encoding the locale expects... regards, tom lane