>>>>> "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)