postgresql7.1 select 1 as element_exists_p, controlling_portal_id, case when acs_permission__permission_p(:element_id, :user_id, 'read') = 't' then 1 else 0 end as element_write_p from portal_elements where element_id = :element_id select portal_element__new ( :element_id, :name, :description, :exportable_p, :datasource_id, :default_portal_id, :template_id, null, null ) select portal_element__make_available( :element_id, :default_portal_id )