Re: unexpected (to me) sorting order

From: Alberto Cabello Sánchez <alberto(at)unex(dot)es>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: unexpected (to me) sorting order
Date: 2015-04-08 09:56:16
Message-ID: 20150408115616.0414b63cf88f430139c35187@unex.es
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, 08 Apr 2015 11:36:01 +0200
Chris Mair <chris(at)1006(dot)org> wrote:

> PostreSQL relies on the OS's C lib. So this kind
> of ordering problems depend on the OS' idea about
> collations.
>
> I don't know what's the rationale behin this,
> but it looks like Linux ignores the . when doing the sort.

Not only '.'. Sorting by VARCHAR is not ASCII order, but "alphabetical" (whatever
it means), which causes some behaviour to be more real-life oriented than
logically coherent, like this one:

select * from ejemplo order by texto;

id | texto
----+----------
2 | Lalin
1 | La Palma
3 | Lasarte

It is pretty obvious that ' ' is not between 'l' and 's', but this makes more
sense than

1 | La Palma
2 | Lalin
3 | Lasarte

--
Alberto Cabello Sánchez
<alberto(at)unex(dot)es>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Filipe Pina 2015-04-08 10:23:00 Re: Serializable transaction restart/re-execute
Previous Message Björn Lundin 2015-04-08 09:47:00 Re: unexpected (to me) sorting order