From: Kristian Jörg <krjg@devo.se>
Cc: Richard Huxton <dev@archonet.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Sort order with spaces?
Date: Wed, 17 Sep 2003 14:39:28 +0200
Message-ID: <3F685600.3010606@devo.se> (raw)
In-Reply-To: <3F6853E4.3000604@devo.se>
References: <3F682DB3.6080905@devo.se>
<200309171144.02871.dev@archonet.com>
<3F6853E4.3000604@devo.se>
Kristian Jörg wrote:
>
>
> 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!
Woops, a type above. My sql is of course:
select * from mytable where normtext>= 'LU' order by normtext;
>
> 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.jorg@devo.se |
>| Sweden | http://www.devo.se |
>+-----------------------------+------------------------------+
>
--
\\|//
(@ @)
+------ooO--(_)--Ooo----------+------------------------------+
| Kristian Jörg | Phone: +46 54 153395 |
| Devo IT AB | Fax: +46 54 153389 |
| Box 533, SE-651 12 KARLSTAD | mailto:kristian.jorg@devo.se |
| Sweden | http://www.devo.se |
+-----------------------------+------------------------------+
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: krjg@devo.se, dev@archonet.com
Subject: Re: Sort order with spaces?
In-Reply-To: <3F685600.3010606@devo.se>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox