Re: Sort order with spaces? - Mailing list pgsql-sql

From Kristian Jörg
Subject Re: Sort order with spaces?
Date
Msg-id 3F685600.3010606@devo.se
Whole thread Raw
In response to Re: Sort order with spaces?  (Kristian Jörg <krjg@devo.se>)
Responses Re: Sort order with spaces?  (Richard Huxton <dev@archonet.com>)
List pgsql-sql
<br /><br /> Kristian Jörg wrote:<br /><blockquote cite="mid3F6853E4.3000604@devo.se" type="cite"></blockquote><br
/><br/> Richard Huxton wrote:<br /><blockquote cite="mid200309171144.02871.dev@archonet.com" type="cite"><pre
wrap="">OnWednesday 17 September 2003 10:47, Kristian Jörg wrote: </pre><blockquote type="cite"><pre wrap="">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   </pre></blockquote><pre wrap="">
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. </pre></blockquote><br /> Hi Richard!<br /><br /> 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
restoredthe database. The same ordering appears...<br /> I did look through all the manuals and I noted that the method
forsetting locale is different for 7.2 and 7.3, so I followed the 7.2 docs. My postgres version is 7.2. <br /><br />
Thetable keeps the data above in a column named "NORMTEXT" and my SQL statement for the result above is:<br /> select *
frommytable where NORMTEXT >=  'LU'<br /> Nothing out of the ordinary there..<br /> Any help on this matter is
highlyappreciated! <br /><br /> Woops, a type above. My sql is of course:<br /> select * from mytable where
normtext>= 'LU' order by normtext;<br /><br /><blockquote cite="mid3F6853E4.3000604@devo.se" type="cite"><br />
Regards<br/> Kristian<br /><pre class="moz-signature" cols="72">--           \\|//          (@ @)
 
+------ooO--(_)--Ooo----------+------------------------------+
| Kristian Jörg               | Phone: +46 54 153395         |
| Devo IT AB                  | Fax:   +46 54 153389         |
| Box 533, SE-651 12 KARLSTAD | <a class="moz-txt-link-freetext"
href="mailto:kristian.jorg@devo.se">mailto:kristian.jorg@devo.se</a>|
 
| Sweden                      | <a class="moz-txt-link-freetext" href="http://www.devo.se">http://www.devo.se</a>
   |
 
+-----------------------------+------------------------------+</pre></blockquote><br /><pre class="moz-signature"
cols="72">--          \\|//          (@ @)
 
+------ooO--(_)--Ooo----------+------------------------------+
| Kristian Jörg               | Phone: +46 54 153395         |
| Devo IT AB                  | Fax:   +46 54 153389         |
| Box 533, SE-651 12 KARLSTAD | <a class="moz-txt-link-freetext"
href="mailto:kristian.jorg@devo.se">mailto:kristian.jorg@devo.se</a>|
 
| Sweden                      | <a class="moz-txt-link-freetext" href="http://www.devo.se">http://www.devo.se</a>
   |
 
+-----------------------------+------------------------------+</pre>

pgsql-sql by date:

Previous
From: Kristian Jörg
Date:
Subject: Re: Sort order with spaces?
Next
From: Richard Huxton
Date:
Subject: Re: Sort order with spaces?