BUG #4338: Order by seems to trim some characters before sort

From: "Domingo Alvarez Duarte" <mingodad(at)gmail(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #4338: Order by seems to trim some characters before sort
Date: 2008-08-02 09:59:12
Message-ID: 200808020959.m729xCEG065225@wwwmaster.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


The following bug has been logged online:

Bug reference: 4338
Logged by: Domingo Alvarez Duarte
Email address: mingodad(at)gmail(dot)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.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2008-08-02 15:20:04 Re: BUG #4338: Order by seems to trim some characters before sort
Previous Message Heeman Lee 2008-08-01 14:38:25 psql's copy binary to stdout