dbTalk Databases Forums  

[BUGS] BUG #1027: incorrect result from 'order by'

mailing.database.pgsql-bugs mailing.database.pgsql-bugs


Discuss [BUGS] BUG #1027: incorrect result from 'order by' in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
PostgreSQL Bugs List
 
Posts: n/a

Default [BUGS] BUG #1027: incorrect result from 'order by' - 12-24-2003 , 12:56 PM







The following bug has been logged online:

Bug reference: 1027
Logged by: William H Copson

Email address: copson@u.arizona.edu

PostgreSQL version: 7.5 Dev

Operating system: Redhat 7.2 (highly modified)

Description: incorrect result from 'order by'

Details:

The following:

drop table tst;
create table tst (
name varchar(25));
insert into tst values ('LEE,ADAM');
insert into tst values ('LEEBERMAN,JOHN');
insert into tst values ('LEE,RALPH');
select name from tst order by name;

Produces the following output:

DROP TABLE
CREATE TABLE
INSERT 3307587 1
INSERT 3307588 1
INSERT 3307589 1
name
----------------
LEE,ADAM
LEEBERMAN,JOHN
LEE,RALPH
(3 rows)

Expected output:
name
----------------
LEE,ADAM
LEE,RALPH
LEEBERMAN,JOHN
(3 rows)

I have tried databases with SQL_ASCII, LATIN1 and LATIN2
encoding with the same result.
From this small example and others involving an employee
table (80K+ records) it appears that the comma is being
parsed out prior to the sort (i.e. 'LEEB' sorts after
'LEEA' and before 'LEER').



---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Reply With Quote
  #2  
Old   
Tom Lane
 
Posts: n/a

Default Re: [BUGS] BUG #1027: incorrect result from 'order by' - 12-25-2003 , 10:22 AM






"PostgreSQL Bugs List" <pgsql-bugs (AT) postgresql (DOT) org> writes:
Quote:
Description: incorrect result from 'order by'
You initdb'd in the wrong locale. You are expecting sort order as in
C locale, but that isn't the default locale setting in recent Red Hat
releases --- en_US is probably what you're using, and that result is
correct according to en_US. (If you don't believe me, try it with
"sort".)

Quote:
I have tried databases with SQL_ASCII, LATIN1 and LATIN2
encoding with the same result.
Database encoding doesn't affect this. You'll need to re-initdb
with the desired locale environment.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.