postgresql 7.1 select etp__get_folder_id(:package_id) select i1.item_id, i1.tree_sortkey, coalesce(( select tree_sortkey from cr_items i2 where i2.tree_sortkey > i1.tree_sortkey and i2.parent_id = :parent_id and i2.name <> 'index' and $i2_select_criteria order by i2.tree_sortkey limit 1), ( select i2.tree_sortkey from cr_items i2 where i2.parent_id = :parent_id and i2.name <> 'index' and $i2_select_criteria order by i2.tree_sortkey limit 1)) as next_sortkey from cr_items i1 where i1.parent_id = :parent_id and i1.name <> 'index' and $i1_select_criteria order by i1.tree_sortkey; select etp__create_page(:parent_package_id, :date, :date, :content_type) select etp__create_extlink(:parent_package_id, :log_url, :link_label, :link_description); select u.user_id, p.first_names || ' ' || p.last_name as name from users u, persons p where u.screen_name = :nick and p.person_id = u.user_id limit 1