Re: [HACKERS] EquivalenceClasses vs volatile functions

2007-11-06 Thread Tom Lane
Gregory Stark <[EMAIL PROTECTED]> writes: > What if the equivalence class is in more than one place in the ORDER BY? That's not a problem. ORDER BY 1,1 is not different from ORDER BY 1, even if the referenced expression is volatile, because the secondary sort key is useless anyway. > And what w

Re: [HACKERS] EquivalenceClasses vs volatile functions

2007-11-06 Thread Gregory Stark
"Tom Lane" <[EMAIL PROTECTED]> writes: > select random() as a, random() as b from foo order by b, a; > > And it definitely seems the wrong thing for the last one. Ouch. > What I'm thinking of doing is adding a field to EquivalenceClass that > carries the ressortgroupref of the originating

[HACKERS] EquivalenceClasses vs volatile functions

2007-11-06 Thread Tom Lane
Awhile back there was some discussion about how the system assumes that syntactically equal sort expressions can be considered interchangeable, which falls down if volatile functions are involved: http://archives.postgresql.org/pgsql-general/2006-11/msg01523.php I seem to recall the issue coming up