order by text-type : whitespaces ignored??

From: peter pilsl <pilsl(at)goldfisch(dot)at>
To: pgsql-general(at)postgresql(dot)org
Subject: order by text-type : whitespaces ignored??
Date: 2006-12-13 08:17:55
Message-ID: 457FB733.2070602@goldfisch.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


I just get my mind crossed here:

I do a simple select with order on a text-type. In my opinion entries with
leading spaces should be either first (or maybe last) in the list.
But in my select the whitespace just seems to be ignored:

Note that the second row has a leading space and should imho be first entry.

# select traeger from wb_traeger where id>24 order by traeger;
traeger
-----------------------------------------
GliA - gehirn | lern | impuls | agentur
Sonstige Träger
Volkshochschule Floridsdorf
Zukunftszentrum Tirol
(4 rows)

note that this not only applies to leading spaces:

# select 'x'||traeger from wb_traeger where id>24 order by 'x'||traeger;
?column?
------------------------------------------
xGliA - gehirn | lern | impuls | agentur
x Sonstige Träger
xVolkshochschule Floridsdorf
xZukunftszentrum Tirol
(4 rows)

the type of my column is simple text:

# \d wb_akademie
Table "public.wb_akademie"
Column | Type | Modifiers

-------------+-----------------------------+----------------------------------------------------
<skip>
traeger | text |
<skip>

Is there any way to order so that entries with leading spaces are listed first??

thnx,
peter

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Gergely CZUCZY 2006-12-13 08:20:34 [girgen@FreeBSD.org: Re: port fault on pg_ctl's place]
Previous Message A. Kretschmer 2006-12-13 08:15:29 Re: changing the permission of _lots_ of tables