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

From Tom Lane
Subject Re: BUG #4338: Order by seems to trim some characters before sort
Date
Msg-id 3627.1217690404@sss.pgh.pa.us
Whole thread Raw
In response to BUG #4338: Order by seems to trim some characters before sort  ("Domingo Alvarez Duarte" <mingodad@gmail.com>)
List pgsql-bugs
"Domingo Alvarez Duarte" <mingodad@gmail.com> writes:
> 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 ?

Because the LC_COLLATE setting is telling it to.  If you try sorting
the same data with sort(1) I'll bet you get the same result.  This
is standard behavior for quite a lot of locale settings.

If you don't like the result then you need to switch to a different
locale setting, probably "C".  Unfortunately, that requires dump,
re-initdb with the correct locale option, reload :-(

            regards, tom lane

pgsql-bugs by date:

Previous
From: "Domingo Alvarez Duarte"
Date:
Subject: BUG #4338: Order by seems to trim some characters before sort
Next
From: "Bhaskar Sirohi"
Date:
Subject: BUG #4339: The postgreSQL service stops abnormally