dbTalk Databases Forums  

Re: [BUGS] Unexpected sort order (suspected bug)

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


Discuss Re: [BUGS] Unexpected sort order (suspected bug) in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Ron Mayer
 
Posts: n/a

Default Re: [BUGS] Unexpected sort order (suspected bug) - 11-27-2006 , 07:31 PM






Jeff Davis wrote:
Quote:
On Mon, 2006-11-27 at 12:44 -0800, Ron Mayer wrote:
Shouldn't the results of this query shown here been sorted by "b" rather than by "a"?

I would have thought since "order by b" is in the outer sql statement it would have
been the one the final result gets ordered by.

li=# select * from (select (random()*10)::int as a, (random()*10)::int as b from generate_series(1,10) order by a) as x order by b;
a | b
---+----
0 | 8
1 | 10
3 | 4
4 | 8
5 | 1
5 | 9
6 | 4
6 | 5
8 | 4
9 | 0
(10 rows)
...

It looks like a planner bug.

Below are two plans; the first fails and the second succeeds. That leads
me to believe it's a planner bug, but what seems strangest to me is that
it does order by a, and not by some new evaluation of (random()*10).

Yeah, looks that way to me too.

So how would I report it. Ccing the bugs list? Guess it can't hurt.

---------------------------(end of broadcast)---------------------------
TIP 7: You can help support the PostgreSQL project by donating at

http://www.postgresql.org/about/donate


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.