postgresql7.1 select photo_album__get_root_folder(:package_id) select photo_album__new_root_folder(:package_id) select acs__magic_object_id('$party') select acs_permission__grant_permission ( :new_folder_id, -- object_id :grantee_id, -- grantee_id :privilege -- privilege ) select content_folder__get_label(:folder_id) select parent_id as start_id, content_item__get_title(item_id,'t') as final from cr_items where item_id = :item_id select case when content_item__get_content_type(i.item_id) = 'content_folder' then 'index?folder_id=' when content_item__get_content_type(i.item_id) = 'pa_album' then 'album?album_id=' else 'photo?photo_id=' end || i.item_id, content_item__get_title(i.item_id,'t') from cr_items i, (select tree_ancestor_keys(cr_items_get_tree_sortkey(:start_id)) as tree_sortkey) parents, (select tree_sortkey from cr_items where item_id = :root_folder_id) as root where i.tree_sortkey = parents.tree_sortkey and i.tree_sortkey > root.tree_sortkey order by i.tree_sortkey asc select exists (select 1 from cr_items i, cr_items i2 where i.item_id = :item_id and i.tree_sortkey between i2.tree_sortkey and tree_right(i2.tree_sortkey) and i2.item_id = :root_folder ) and content_item__get_content_type(:item_id) = :content_type select acs_permission__grant_permission ( :object_id, -- object_id :user_id, -- grantee_id :privilege -- privilege )