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:[EMAIL PROTECTED] |
| Sweden                      | http://www.devo.se           |
+-----------------------------+------------------------------+

Reply via email to