Re: BUG #1082: Order by doesn't sort correctly. - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #1082: Order by doesn't sort correctly.
Date
Msg-id 13837.1077405934@sss.pgh.pa.us
Whole thread Raw
In response to BUG #1082: Order by doesn't sort correctly.  ("PostgreSQL Bugs List" <pgsql-bugs@postgresql.org>)
Responses Re: BUG #1082: Order by doesn't sort correctly.  (Andreas Pflug <pgadmin@pse-consulting.de>)
Re: BUG #1082: Order by doesn't sort correctly.  (Richard Neill <rn214@hermes.cam.ac.uk>)
List pgsql-bugs
Richard Neill <rn214@hermes.cam.ac.uk> writes:
> This ordering is perverse!

No kidding.

> No matter what the priority is of the
> different characters, I cannot understand how the above can arise.

You are assuming that it's a byte-at-a-time process.  It's not.  I
believe the first pass considers only letters and digits.

You can easily prove to yourself that it's not just Postgres.  Here's
an example on my Linux laptop:

[tgl@g3 tgl]$ cat zzz
Cymbal #1
Cymbal - 18 inch
Cymbal #2
[tgl@g3 tgl]$ LC_ALL=C sort zzz
Cymbal #1
Cymbal #2
Cymbal - 18 inch
[tgl@g3 tgl]$ LC_ALL=en_GB sort zzz
Cymbal #1
Cymbal - 18 inch
Cymbal #2
[tgl@g3 tgl]$

            regards, tom lane

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #1082: Order by doesn't sort correctly.
Next
From: Scott Goodwin
Date:
Subject: Re: [HACKERS] Mac OS X, PostgreSQL, PL/Tcl