Re: BUG #2231: Incorrect Order By

From: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
To: "Garoso, Fernando" <fgaroso(at)ig(dot)com(dot)br>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #2231: Incorrect Order By
Date: 2006-02-02 23:13:09
Message-ID: 20060202151059.G34622@megazone.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


On Thu, 2 Feb 2006, Stephan Szabo wrote:

> On Wed, 1 Feb 2006, Garoso, Fernando wrote:
>
> >
> > The following bug has been logged online:
> >
> > Bug reference: 2231
> > Logged by: Garoso, Fernando
> > Email address: fgaroso(at)ig(dot)com(dot)br
> > PostgreSQL version: 8.x
> > Operating system: GNU Linux Debian
> > Description: Incorrect Order By
> > Details:
> >
> > create table tmp ( name char(30) );
> > create index tmp_idx on tmp (name);
> > insert into tmp values ( 'SUEKO' );
> > insert into tmp values ( 'SUE E' );
> > insert into tmp values ( 'SUE T' );
> >
> > select * from tmp order by name;
> >
> >
> > ### Result ###
> >
> > teste=# select * from tmp order by name desc;
> > name
> > --------------------------------
> > SUE T
> > SUEKO
> > SUE E
> > (3 registros)
>
> What locale are you using? The above looks correct to my eye for en_US
> locale on most linux systems which use dictionary sorting.

Hit send accidentally. :( Dictionary sorting rules generally skip spaces
in first pass comparisons. If you're expecting byte order sorting, you'll
want "C" locale. We currently use the system locales for sorting, so if
you want something which say uses non-byte order sorting but also doesn't
skip spaces, you'd need such a locale definition for the system.

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Peter Eisentraut 2006-02-02 23:33:24 Re: BUG #2225: Backend crash -- BIG table
Previous Message Stephan Szabo 2006-02-02 23:08:45 Re: BUG #2231: Incorrect Order By