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.