Re: spanish locale question

From: "Albe Laurenz" <laurenz(dot)albe(at)wien(dot)gv(dot)at>
To: "jbiskofski *EXTERN*" <jbiskofski(at)gmail(dot)com>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: spanish locale question
Date: 2012-04-19 07:30:44
Message-ID: D960CB61B694CF459DCFB4B0128514C207C33E57@exadv11.host.magwien.gv.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

jbiskofski wrote:
> I have a lc_collate problem. Im in Mexico and I need the following three lastnames to be sorted this
> way :
>
> álvarez ( accent on first a )
> chavez
> cota
>
> Using the default locale on my mac ( en_US ) I end up with :
>
> chavez
> cota
> álvarez
>
> So I switched to es_ES.ISO8859-15 and that gives me :
>
> álvarez
> cota
> chavez
>
>
> ... There was a time when the "Real Academia Española" considered "CH", "LL" and "SH" as letters. They
> changed that in 1994 :
>
> In 1994, the RAE ruled that the Spanish consonants "CH" (ché) and "LL" (elle) would hence be
> alphabetized under "C" and under "L", respectively, and not as separate, discrete letters, as in the
> past. The RAE eliminated monosyllabic accented vowels where the accent did not serve in changing the
> word's meaning, examples include: "dio" ("gave"), "vio" ("saw"), both had an acutely-accented vowel
> "ó"; yet the monosyllabic word "sé" ("I know", the first person, singular, present of "saber", "to
> know"; and the singular imperative of "ser", "to be") retains its acutely-accented vowel in order to
> differentiate it from the reflexive pronoun "se".
>
> http://en.wikipedia.org/wiki/Real_Academia_Espa%C3%B1ola
>
>
> I think thats where the problem comes from.
>
> Anyway, any hints/clues/suicide-method-suggestions would be greatly appreciated!

PostgreSQL uses the operating system's collations.
Ask your operating system provider.

On my RHEL 3 Linux system it works as you want it to:

CREATE TABLE mexico(id integer PRIMARY KEY, val text NOT NULL COLLATE "es_ES.utf8");

INSERT INTO mexico VALUES (1, 'cota'), (2, 'álvarez'), (3, 'chavez');

SELECT * FROM mexico ORDER BY val;

id | val
----+---------
2 | álvarez
3 | chavez
1 | cota
(3 rows)

Yours,
Laurenz Albe

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Willy-Bas Loos 2012-04-19 07:38:25 Re: Detecting corrupt table
Previous Message Alban Hertroys 2012-04-19 07:00:07 Re: remove some rows from resultset