postgresql7.1
select acs_object__name(:instance_id);
select contact_id,
coalesce(last_name,'
') as last_name,
coalesce(first_names,'
') as first_names,
coalesce(title,'
') as title,
coalesce(organization,'
') as organization,
coalesce(work_phone,'
') as work_phone,
coalesce(home_phone,'
') as home_phone,
coalesce(fax,'
') as fax,
coalesce(other,'
') as other,
coalesce(email,'
') as email,
acs_permission__permission_p(acr.rel_id,:user_id,'delete') as delete_p,
acr.rel_id
from ab_contacts_related acr
where acs_permission__permission_p(contact_id,:user_id,'read') = 't'
and object_id = :instance_id
[value_if_exists search_filter]