Re: Character encoding and string matches - Mailing list pgsql-general

From Tom Lane
Subject Re: Character encoding and string matches
Date
Msg-id 28854.1133966389@sss.pgh.pa.us
Whole thread Raw
In response to Re: Character encoding and string matches  ("Daniel Verite" <daniel@manitou-mail.org>)
List pgsql-general
"Daniel Verite" <daniel@manitou-mail.org> writes:
>     Richard van den Berg wrote:
>> During the
>> pg_restore, it complained about failing to create several indexes
>> because of duplicates. Inspecting these cases showed that the bogus
>> characters are to blame. It seems that these characters (that are
>> probably not defined in LATIN1) are now turned into wildcards: they will
>> match any other character. Is this an expected result from running a non
>> SQL_ASCII database?

> It should depend on the locale. Can you tell the results of
> `show lc_ctype` and `show lc_collate`?

Yeah, there are a lot of locale definitions out there that seem to
simply fail on unexpected data :-(

If you don't actually need locale-specific sorting or upper()/lower()
behavior, a safe choice is to run with LC_CTYPE and LC_COLLATE set to
'C' while you set the database encoding to whatever you need.  This
will support encoding validity checks and transcoding to different
client encodings, but sorting and upper/lower will just use the default
C-locale behavior.

            regards, tom lane

pgsql-general by date:

Previous
From: Martijn van Oosterhout
Date:
Subject: Re: PostgreSQL 8.1.0 RHEL / Debian incompatible packages
Next
From: Richard van den Berg
Date:
Subject: Re: Character encoding and string matches