On Tue, 16 June 1998, at 10:32:39, Vadim Mikheev wrote:
> Another issue - handling of functions with constant args
> in queries - for query
>
> select * from T where A = upper ('bbb')
>
> function upper ('bbb') will be executed for each tuple in T!
> More of that - if there is index on T(A) then this index will
> not be used for this query!
> Obviously, upper ('bbb') should be executed (by Executor, not
> parser/planner) once: new Param type (PARAM_EXEC) implemented
> for subselects could help here too...
> ---
>
> Actually, this is easy to fix...
I was going to reply to this but never did -- how do you tell if it
needs to be executed once per query or once per tuple? What if you
wanted to call a function which returned a different value for each
tuple, like random()?