Sort order confusion - Mailing list pgsql-general

From Steve Crawford
Subject Sort order confusion
Date
Msg-id 200402051612.43686.scrawford@pinpointresearch.com
Whole thread Raw
Responses Re: Sort order confusion  (Stephen Robert Norris <srn@commsecure.com.au>)
Re: Sort order confusion  (Stephan Szabo <sszabo@megazone.bigpanda.com>)
List pgsql-general
I am suffering some sort order confusion. Given a database, "foo",
with a single character(4) column of data left padded with spaces I
get:

select * from foo order by somechars;

somechars
-----------
    0
    1
   10
  100
 1011
  111
 1512
    2
  222
    3
  333

The output I desire is a basic ASCII sort:

somechars
-----------
    0
    1
    2
    3
   10
  100
  111
  222
  333
 1011
 1512

(This sample set just has spaces and numeric digits but could have
other characters - I want the output in ASCII sort order)

1. What is the correct way to do this?

2. How do I verify the locale setting of an existing database cluster
(to verify that I really initialized it as "initdb -d --locale=C -D
/var/lib/pgsql/data")?

3. Should I have included "--enable-locale" or similar option when I
built Postgresql (the build is vanilla 7.4.1 "./configure ; make ;
make install")?

Cheers,
Steve


pgsql-general by date:

Previous
From: Lamar Owen
Date:
Subject: Re: PostgreSQL 7.4.1 and pgdb.py
Next
From: Stephen Robert Norris
Date:
Subject: Re: Sort order confusion