postgresql7.1
select acs_person_id,
given_name,
family_name,
middle_name,
preferred_given_name,
formatted_name,
given_name || ' ' || family_name as pretty_name,
case when acs_permission__permission_p(acs_person_id,:user_id,'write') = 't'
then 1 else 0 end as write_p,
case when acs_permission__permission_p(acs_person_id,:user_id,'delete') = 't'
then 1 else 0 end as delete_p
from acs_persons p
where acs_person_id = :acs_person_id