BUG #4338: Order by seems to trim some characters before sort - Mailing list pgsql-bugs

From Domingo Alvarez Duarte
Subject BUG #4338: Order by seems to trim some characters before sort
Date
Msg-id 200808020959.m729xCEG065225@wwwmaster.postgresql.org
Whole thread Raw
Responses Re: BUG #4338: Order by seems to trim some characters before sort
List pgsql-bugs
The following bug has been logged online:

Bug reference:      4338
Logged by:          Domingo Alvarez Duarte
Email address:      mingodad@gmail.com
PostgreSQL version: 8.2.9
Operating system:   linux
Description:        Order by seems to trim some characters before sort
Details:

I have a test table:
CREATE TABLE test
(
  id serial NOT NULL,
  t character varying,
  CONSTRAINT test_pkey PRIMARY KEY (id)
)
with tis data retrieved by: select * from test order by 2

4;"---abacate"
3;"arpa"
5;"--- bacate"
1;"dad"
2;"--dad"

I expect the result to be :

5;"--- bacate"
4;"---abacate"
2;"--dad"
3;"arpa"
1;"dad"

It seems that postgresql is issuing a kind of trim on the column value
before sort/compare, because it's ignoring spaces and '-' wich I use
propositally to move some values to front.

Why postgresql is behaving this way ?
I couldn't find an expalanation in the documentation.

pgsql-bugs by date:

Previous
From: Heeman Lee
Date:
Subject: psql's copy binary to stdout
Next
From: Tom Lane
Date:
Subject: Re: BUG #4338: Order by seems to trim some characters before sort