Re: Locale and pattern matching

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: pgsql-sql(at)postgresql(dot)org
Cc: Hélder M(dot) Vieira <hmv(at)mail(dot)telepac(dot)pt>
Subject: Re: Locale and pattern matching
Date: 2005-12-08 08:21:49
Message-ID: 200512080921.49722.peter_e@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hélder M. Vieira wrote:
> For instance, if the pattern specifies an uppercase 'A' with an
> accute accent, then it will match a lowercase 'A' with an accute
> accent, but not an upper or lower case 'A' with a tilde.
> This behaviour seems inconsistent with that of the ORDER BY clause,
> which considers all forms of a vowel as equal

This is not exactly true. Sorting just goes through the strings in
multiple passes, looking at the "general" letter first, then at the
case, then at the accents, until it finds a difference.

> Shouldn't case insensitive pattern matching follow the same collation
> weights that ORDER BY uses ?

Even if it did, it would not help you, as explained above. Moreover,
the collation rules of some locales are sufficiently weird that a
consistent behavior between sorting and pattern matching is impossible
to achieve.

> Until now, I've been selecting LATIN1 encoding, but after a few
> tests, I came to think that LATIN9 is a better option (the euro
> sign...). For those who regularly use LATIN9, what is your opinion ?
> Is it indeed a better option ?

Yes.

--
Peter Eisentraut
http://developer.postgresql.org/~petere/

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Alexandre Gonçalves Jacarandá 2005-12-08 11:24:17 Re: Help on function creating
Previous Message Michael Fuhr 2005-12-08 07:21:45 Re: cannot alter column data type to "date"