Re: ORDER BY vs. volatile functions - Mailing list pgsql-hackers

From Andrew Gierth
Subject Re: ORDER BY vs. volatile functions
Date
Msg-id 87d43igv4w.fsf@news-spur.riddles.org.uk
Whole thread Raw
In response to Re: ORDER BY vs. volatile functions  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
>>>>> "Tom" == Tom Lane <tgl@sss.pgh.pa.us> writes:
Tom> Ron Mayer <rm_pg@cheapcomplexdevices.com> writes:>> [1]
http://archives.postgresql.org/pgsql-general/2006-11/msg01544.php
Tom> FWIW, the behavior has changed from the time of that discussion ---Tom> we now track sort ordering using
EquivalenceClasses,which are ableTom> to distinguish different instances of textually equal() volatileTom> expressions.
The particular cases ofTom>     select random() from foo order by 1;Tom>     select random() from foo order by
random();Tom>still behave the same, but that's intentional for backwardsTom> compatibility (and because SQL99 forbids
thefirst, which would meanTom> there's no way to get the behavior except via deprecated syntax).
 

SQL99 doesn't forbid:

select random() as r from foo order by r;

or

select r from (select random() as r from foo) as s order by r;

-- 
Andrew (irc:RhodiumToad)


pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: Update on Insert
Next
From: Andres Freund
Date:
Subject: Re: Unpredictable shark slowdown after migrating to 8.4