The following syntax does
work. I suspect it may be faster in some cases and slower in others
depending on how expensive the function is.
select * from
(select *, rank_for_search('david'::varchar,first_names) as rank
from users) qry_alias
where rank > 50
order by rank desc
IsCacheable (However it is spelled) is certainly the way to go with
the rank_for_search function. The same arguments passed in will
always produce the same result.