Re: Sort order with spaces?

From: Kristian Jörg <krjg(at)devo(dot)se>
To: Richard Huxton <dev(at)archonet(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Sort order with spaces?
Date: 2003-09-17 12:30:28
Message-ID: 3F6853E4.3000604@devo.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Richard Huxton wrote:

>On Wednesday 17 September 2003 10:47, Kristian Jörg wrote:
>
>
>>Hello!
>>
>>I am having troubles with sort order in Postgres. It seems that space is
>>not handled at all?
>>For instance the following rows are sorted in MS SQL Server as:
>>
>>LUNDGREN
>>M L R
>>MACDOWELL
>>MUSCLE
>>
>>But in Postgres I get this order:
>>
>>LUNDGREN
>>MACDOWELL
>>M L R
>>MUSCLE
>>
>>
>
>Sort order depends upon your locale settings (specifically LC_COLLATE), which
>will have been set when you ran "initdb". Basically, sort orders for C ,
>en_GB and fr will all be different. I'm guessing you expect "C" style
>sorting.
>
>Check the end of your postgresql.conf file to see what settings you currently
>have.
>See the manuals (Localization section) and list archives for plenty of
>details.
>
>

Hi Richard!

Unfortunately this does not seem to help! I dumped the database,
recreated the cluster with initdb with LC_COLLATE = C (and even tried
setting LC_CTYPE to C also), and restored the database. The same
ordering appears...
I did look through all the manuals and I noted that the method for
setting locale is different for 7.2 and 7.3, so I followed the 7.2 docs.
My postgres version is 7.2.

The table keeps the data above in a column named "NORMTEXT" and my SQL
statement for the result above is:
select * from mytable where NORMTEXT >= 'LU'
Nothing out of the ordinary there..
Any help on this matter is highly appreciated!

Regards
Kristian

--
\\|//
(@ @)
+------ooO--(_)--Ooo----------+------------------------------+
| Kristian Jörg | Phone: +46 54 153395 |
| Devo IT AB | Fax: +46 54 153389 |
| Box 533, SE-651 12 KARLSTAD | mailto:kristian(dot)jorg(at)devo(dot)se |
| Sweden | http://www.devo.se |
+-----------------------------+------------------------------+

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Kristian Jörg 2003-09-17 12:39:28 Re: Sort order with spaces?
Previous Message Christoph Haller 2003-09-17 12:00:56 Re: sub query