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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Domingo Alvarez Duarte" <mingodad(at)gmail(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #4338: Order by seems to trim some characters before sort
Date: 2008-08-02 15:20:04
Message-ID: 3627.1217690404@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

"Domingo Alvarez Duarte" <mingodad(at)gmail(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Bhaskar Sirohi 2008-08-04 11:02:09 BUG #4339: The postgreSQL service stops abnormally
Previous Message Domingo Alvarez Duarte 2008-08-02 09:59:12 BUG #4338: Order by seems to trim some characters before sort