Re: [HACKERS] seq scan only when function not in subquery (bug?) - Mailing list pgsql-hackers

From Brett McCormick
Subject Re: [HACKERS] seq scan only when function not in subquery (bug?)
Date
Msg-id 13702.56712.737998.57600@web0.speakeasy.org
Whole thread Raw
In response to Re: [HACKERS] seq scan only when function not in subquery (bug?)  (Vadim Mikheev <vadim@krs.ru>)
Responses Re: [HACKERS] seq scan only when function not in subquery (bug?)  (dg@illustra.com (David Gould))
List pgsql-hackers
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()?

pgsql-hackers by date:

Previous
From: Brett McCormick
Date:
Subject: Re: [HACKERS] non-functional update notice unneccesarily
Next
From: David Hartwig
Date:
Subject: Re: [HACKERS] Wishlist for next version: group by clause