Skip site navigation (1) Skip section navigation (2)

BUG #1082: Order by doesn't sort correctly.

From: "PostgreSQL Bugs List" <pgsql-bugs(at)postgresql(dot)org>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #1082: Order by doesn't sort correctly.
Date: 2004-02-21 19:07:01
Message-ID: 20040221190701.1B668CF49B4@www.postgresql.com (view raw or flat)
Thread:
Lists: pgsql-bugs
The following bug has been logged online:

Bug reference:      1082
Logged by:          Richard Neill

Email address:      rn214(at)cam(dot)ac(dot)uk

PostgreSQL version: 7.3.4

Operating system:   Linux

Description:        Order by doesn't sort correctly.

Details: 

ORDER BY sorts the following in this order:
   
Cymbal #1
Cymbal - 18 inch
Cymbal #2

It ought to be thus:

Cymbal #1
Cymbal #2
Cymbal - 18 inch

or possibly thus:

Cymbal - 18 inch
Cymbal #1
Cymbal #2


-------------------------------------------------
Here's an example sql script to reproduce the bug.


CREATE TABLE tbl_testinstruments(
	instrumentid	integer,					instrument 	character varying(300)	 	
);

INSERT INTO tbl_testinstruments (instrumentid, instrument) VALUES (1, 
'Antique Cymbals #1'); 
INSERT INTO tbl_testinstruments (instrumentid, instrument) VALUES (2, 
'Antique Cymbals #2'); 
INSERT INTO tbl_testinstruments (instrumentid, instrument) VALUES (3, 'Clash 
Cymbals, French - 20 inch'); 
INSERT INTO tbl_testinstruments (instrumentid, instrument) VALUES (4, 
'Cymbal #1'); 
INSERT INTO tbl_testinstruments (instrumentid, instrument) VALUES (5, 
'Cymbal #2'); 
INSERT INTO tbl_testinstruments (instrumentid, instrument) VALUES (6, 
'Cymbal - 18 inch'); 
INSERT INTO tbl_testinstruments (instrumentid, instrument) VALUES (7, 
'Cymbal, Sizzle'); 
INSERT INTO tbl_testinstruments (instrumentid, instrument) VALUES (8, 
'Cymbal, Splash'); 

SELECT instrument FROM tbl_testinstruments ORDER BY instrument;


------------------------------------------------
This is the output I get:

        instrument
---------------------------------
 Antique Cymbals #1
 Antique Cymbals #2
 Clash Cymbals, French - 20 inch
 Cymbal #1
 Cymbal - 18 inch
 Cymbal #2
 Cymbal, Sizzle
 Cymbal, Splash
(8 rows)




-------------------------------------------------
I'm using version:

 PostgreSQL 7.3.4 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.3.1 
(Mandrake Linux 9.2 3.3.1-1mdk) 





Responses

pgsql-bugs by date

Next:From: Scott GoodwinDate: 2004-02-21 19:53:58
Subject: Re: Mac OS X, PostgreSQL, PL/Tcl
Previous:From: Tom LaneDate: 2004-02-21 06:51:07
Subject: Re: Mac OS X, PostgreSQL, PL/Tcl

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group