order by text-type : whitespaces ignored?? - Mailing list pgsql-general

From peter pilsl
Subject order by text-type : whitespaces ignored??
Date
Msg-id 457FB733.2070602@goldfisch.at
Whole thread Raw
Responses Re: order by text-type : whitespaces ignored??  (Richard Huxton <dev@archonet.com>)
List 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




pgsql-general by date:

Previous
From: Gergely CZUCZY
Date:
Subject: [girgen@FreeBSD.org: Re: port fault on pg_ctl's place]
Next
From: Richard Huxton
Date:
Subject: Re: order by text-type : whitespaces ignored??