"Merlin Moncure" <[EMAIL PROTECTED]> writes:
> select f(x) from t where id = 1 order by n;
> can cause f to execute for the entire table even if id is unique. 

Really?  I'd consider it a bug if so.  Compare

        select 1/x from t where x > 0

If the presence of zeroes in t can make this throw a zero-divide error,
the database is broken.  In my mind the SQL spec is perfectly clear that
WHERE filtering occurs before evaluation of the SELECT targetlist.
(Sorting, however, occurs afterward --- so there are certainly potential
gotchas of this ilk.  But the specific example you give is bogus.)

                        regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
       subscribe-nomail command to [EMAIL PROTECTED] so that your
       message can get through to the mailing list cleanly

Reply via email to