Re: insensitive collations - Mailing list pgsql-hackers

From Daniel Verite
Subject Re: insensitive collations
Date
Msg-id 3edec684-85a8-40b7-a47c-16c54d6eb54f@manitou-mail.org
Whole thread Raw
In response to Re: insensitive collations  (Jim Finnerty <jfinnert@amazon.com>)
Responses Re: insensitive collations
List pgsql-hackers
    Jim Finnerty wrote:

> SET client_encoding = WIN1252;
> [...]
> postgres=# SELECT * FROM locations WHERE location LIKE 'Franche-Comt__';  --
> the wildcard is applied byte by byte instead of character by character, so
> the 2-byte accented character is matched only by 2 '_'s
>    location
> ----------------
> Franche-Comté
> (1 row)

The most plausible explanation is that the client-side text is encoded
in UTF-8, rather than WIN1252 as declared.

If you added  length('Franche-Comté') to the above query, I suspect
it would tell that the string is one character longer than
expected, and octet_length('Franche-Comté') would be
two-byte longer than expected.

Also dumping the contents of the "location" column with
convert_to() would show that the accents have been
wrongly translated, if the explanation of the encoding snafu is
correct.


Best regards,
--
Daniel Vérité
PostgreSQL-powered mailer: https://www.manitou-mail.org
Twitter: @DanielVerite



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: SP-GiST confusion: indexed column's type vs. index column type
Next
From: Tom Lane
Date:
Subject: Re: Confusing behavior of psql's \e