a strange order by behavior - Mailing list pgsql-sql

From Eyal Wilde
Subject a strange order by behavior
Date
Msg-id BANLkTi=ScMyF7nHQ6nhbyYr9UDrq16U=9g@mail.gmail.com
Whole thread Raw
Responses Re: a strange order by behavior  (Samuel Gendler <sgendler@ideasculptor.com>)
List pgsql-sql
the database collation is: en_US.UTF-8

drop table t1;
create table t1 (recid int ,f1 varchar(20));
insert into t1 values (1,'a');
insert into t1 values (2,' ');
insert into t1 values (3,'aa');
insert into t1 values (4,' a');
select * from t1 order by f1

result:

recid  f1
2      " "        
1      "a"        -- 2 comes before 1 because space is smaller then 'a'. fine.
4      " a"       -- now is see that 1 comes before 4 because space is greater then 'a' !?
3      "aa"       -- now again, 4 comes before 3 because space is smaller the 'a' !?!

can someone explain what's going on?

thanks!

pgsql-sql by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: problem with selecting from a function
Next
From: Samuel Gendler
Date:
Subject: Re: a strange order by behavior