Index: openacs-4/packages/acs-kernel/sql/postgresql/postgresql.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-kernel/sql/postgresql/postgresql.sql,v
diff -u -r1.28 -r1.29
--- openacs-4/packages/acs-kernel/sql/postgresql/postgresql.sql	15 May 2002 15:37:05 -0000	1.28
+++ openacs-4/packages/acs-kernel/sql/postgresql/postgresql.sql	24 Jun 2002 22:17:49 -0000	1.29
@@ -468,6 +468,21 @@
 
 end;' language 'plpgsql' with(iscachable);
 
+create function tree_increment_key(varbit)
+returns varbit as '
+declare
+    p_child_sort_key                alias for $1;
+    v_child_sort_key                integer;
+begin
+    if p_child_sort_key is null then
+        v_child_sort_key := 0;
+    else
+        v_child_sort_key := tree_leaf_key_to_int(p_child_sort_key) + 1;
+    end if;
+
+    return int_to_tree_key(v_child_sort_key);
+end;' language 'plpgsql' with(iscachable);
+
 create function tree_left(varbit) returns varbit as '
 
 -- Create a key less than or equal to that of any child of the
