Forum OpenACS Q&A: Response to Weird PostgreSQL SELECT processing
8: Response to Weird PostgreSQL SELECT processing (response to 1)
Posted by David Walker on 08/24/02 01:45 PM
select p.placement_id from placements p, (select placement_id,count(*),warp_user_access(0,'placement',p.placement_id) as warped_access from placement_log log where placement_id=177 group by placement_id) l where l.placement_id=p.placement_id and l.warped_access ;
Try moving the function call into the select portion of a sub-query that is limited on placement_id. That way the function should only be executed for the placement_id(s) that are returned. Then refer to that alias in your outer query to limit on that.