Index: openacs-4/packages/acs-content-repository/tcl/filter-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/tcl/filter-procs-postgresql.xql,v diff -u -r1.12 -r1.13 --- openacs-4/packages/acs-content-repository/tcl/filter-procs-postgresql.xql 21 Jan 2005 20:41:56 -0000 1.12 +++ openacs-4/packages/acs-content-repository/tcl/filter-procs-postgresql.xql 26 Jun 2015 09:32:08 -0000 1.13 @@ -5,16 +5,16 @@ - select 0 as tree_level, '' as name , 'Home' as title - UNION - select t.tree_level, i.name, content_item.get_title(t.context_id) as title - from (select o2.context_id, tree_level(o2.tree_sortkey) as tree_level - from (select * from acs_objects where object_id = :item_id) o1, acs_objects o2 - where context_id <> content_item__get_root_folder() - and o1.tree_sortkey between o2.tree_sortkey and tree_right(o2.tree_sortkey)) t, - cr_items i - where i.item_id = t.context_id - order by tree_level + With RECURSIVE child_items AS ( + select 0 as lvl, i.item_id, ''::text as name, i.parent_id, 'Home'::text as title + from cr_items i, cr_revisions r + where i.item_id = :item_id and i.live_revision = r.revision_id + UNION ALL + select child_items.lvl+1, i.item_id, i.name, i.parent_id, r.title + from cr_items i, cr_revisions r, child_items + where i.parent_id = child_items.item_id and i.live_revision = r.revision_id + ) + select * from child_items;