postgresql7.1 select element_id, name, datasource_id, template_id, description, config_id, exportable_p, filename, case when acs_permission__permission_p(element_id, :user_id, 'read') = 't' then 1 else 0 end as element_read_p, case when acs_permission__permission_p(template_id, :user_id, 'read') = 't' then 1 else 0 end as template_read_p from portal_elem_tmpl where element_id = :element_id select key, value from portal_element_parameters where config_id = :config_id and acs_permission__permission_p(config_id, :user_id, 'read') = 't' order by key select datasource_id, name, description, content, mime_type, data_type, default_config_id, case when acs_permission__permission_p(datasource_id, :user_id, 'read') = 't' then 1 else 0 end as datasource_read_p from portal_datasources where datasource_id = :datasource_id select m.element_id, m.region, m.sort_key from portal_element_map m where m.portal_id = :portal_id and acs_permission__permission_p(m.element_id, :user_id, 'read') = 't' order by region, sort_key, element_id select portal__parent(default_portal_id) as info_value from portals where package_id = :package_id and owner_id is null select region, case when immutable_p = 't' then 1 else 0 end as immutable_p from portal_supported_regions where template_id = :template_id