Re: Weird sorting order

From: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
To: <pgsql-admin(at)postgresql(dot)org>, "Robert Voinea" <robert(dot)voinea(at)topex(dot)ro>
Subject: Re: Weird sorting order
Date: 2010-07-16 15:34:06
Message-ID: 4C40359E0200002500033711@gw.wicourts.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Robert Voinea <robert(dot)voinea(at)topex(dot)ro> wrote:

> Why is it that when running the query:
>
> SELECT * FROM test ORDER BY val;
>
> I get the following result?
> id | val
> ----+-------
> 1 | 200
> 2 | 201
> 3 | 202
> 4 | 203
> 5 | 210
> 6 | 211
> 7 | 2##23
> 8 | 2##24
> 9 | 2##25
> 10 | 2##33
> 11 | ##26
> 12 | 2ff
> 13 | ##31
> 14 | ##32
> 15 | ##34
> (15 rows)
>
> Shouldn't value '2ff' be placed right after '211' but before
> '2##23'?

That depends on your collation configuration. What do you get
from?:

show lc_collate;

In many collations, special characters such as '#' are ignored.

-Kevin

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Bill MacArthur 2010-07-16 15:34:59 Re: Weird sorting order
Previous Message Brad Nicholson 2010-07-16 14:00:21 Re: Setting up a warm standby server - some questions