Sort order confusion

From: Steve Crawford <scrawford(at)pinpointresearch(dot)com>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Sort order confusion
Date: 2004-02-06 00:12:43
Message-ID: 200402051612.43686.scrawford@pinpointresearch.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Stephen Robert Norris 2004-02-06 00:21:41 Re: Sort order confusion
Previous Message Lamar Owen 2004-02-05 23:32:44 Re: PostgreSQL 7.4.1 and pgdb.py