Re: ORDER BY vs. volatile functions

From: Ron Mayer <rm_pg(at)cheapcomplexdevices(dot)com>
To: Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: ORDER BY vs. volatile functions
Date: 2009-11-16 12:19:53
Message-ID: 4B014369.9040609@cheapcomplexdevices.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Andrew Gierth wrote:
> This query:
>
> select random() from generate_series(1,10) order by random();
> produces sorted output. Should it?

I recall a workaround from a different thread[1] if specifically
were looking for random ordering of random numbers is:
select random() from foo order by random()+1;

The thread has more odd corner cases with multiple calls
to random() and sorts as well.

[1] http://archives.postgresql.org/pgsql-general/2006-11/msg01544.php

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Sabino Mullane 2009-11-16 14:14:40 Re: Listen / Notify rewrite
Previous Message Peter Eisentraut 2009-11-16 12:17:55 Re: named parameters in SQL functions