Re: Order By and Comparisson

From: Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>
To: "howardnews(at)selestial(dot)com *EXTERN*" <howardnews(at)selestial(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Order By and Comparisson
Date: 2014-04-07 10:58:12
Message-ID: A737B7A37273E048B164557ADEF4A58B17CEBF27@ntex2010i.host.magwien.gv.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

howardnews(at)selestial(dot)com wrote:
> just as I thought I had postgres mastered :) the ordering of strings is
> causing me some confusion.
>
> Can someone explain how the database orders strings in the ORDER BY command.
>
> My example:
>
> My database is encoding is UTF-8, and default language is english,
>
> If I have a text column in a table with the following rows:
>
> 'a'
> 'A'
> '~'
>
> Then in UTF-8, I would expect the order to give me
>
> 'A'
> 'a'
> '~'
>
> But instead I get:
>
> '~'
> 'a'
> 'A'
>
> Is there anywhere in the documentation I can get a more detailed
> explanation of this?

http://www.postgresql.org/docs/current/static/collation.html#AEN33298

The ordering depends on the collation.
Which collations are available and how they order depends on your operating system.

What is your OS and what do you get for
SHOW lc_collate;

Yours,
Laurenz Albe

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Rebecca Clarke 2014-04-07 10:58:30 Re: Initial queries of day slow
Previous Message howardnews@selestial.com 2014-04-07 10:04:23 Order By and Comparisson