Re: spanish locale question

From: Tulio <tulio(dot)carrasco(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: spanish locale question
Date: 2012-05-02 22:45:07
Message-ID: 1335998707388-5681819.post@n5.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi there,

Let me expand the collate situation. I´m from Perú and I have turned
everything in postgresql.conf as 'es_PE.UTF-8' even the
default_text_search_config = 'pg_catalog.spanish'. Even my Ubuntu 12.04
works in English I have es_PE locale too.

In Spanish vowels as "u" is equal as "ú" or even "ü". So let me build an
example:

CREATE TABLE pru(id integer PRIMARY KEY, dad text, mum text, name text);

INSERT INTO pru VALUES (1, 'león','valencia', 'josé'), (2, 'leon',
'mendoza', 'juan'), (3, 'león', 'valárd', 'jose'), (4, 'león','válencia',
'jos'), (5, 'león', 'mendoza', 'jua'), (6, 'leon', 'valencia', 'josie'), (7,
'león', 'valencia', 'josie');

if I do

SELECT * FROM pru order by dad,mum,name;

I get:

id | dad | mum | name
----+------+----------+-------
2 | leon | mendoza | juan
6 | leon | valencia | josie
5 | león | mendoza | jua
3 | león | valárd | jose
1 | león | valencia | josé
7 | león | valencia | josie
4 | león | válencia | jos
(7 rows)

Which is a wrong order (collation) in Spanish and I don´t understand why.
But, I noticed that if I do:

SELECT * FROM pru order by dad || mum || name;

I get the correct order:

id | dad | mum | name
----+------+----------+-------
5 | león | mendoza | jua
2 | leon | mendoza | juan
3 | león | valárd | jose
4 | león | válencia | jos
1 | león | valencia | josé
6 | leon | valencia | josie
7 | león | valencia | josie
(7 rows)

Is this the correct way to order in Postgresql and if it´s not Does anyone
have an idea and could please explain it to me?
Thanks in advance.

Tulio

--
View this message in context: http://postgresql.1045698.n5.nabble.com/spanish-locale-question-tp5650043p5681819.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Matrix Guy 2012-05-02 22:59:23 Is there away to output a time stamp in a specified time zone with the time zone indicator (e.g. EDT)
Previous Message Tom Lane 2012-05-02 22:00:25 Re: new rows based on existing rows