Index: openacs-4/packages/acs-content-repository/sql/postgresql/content-item.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/sql/postgresql/content-item.sql,v
diff -u -r1.36 -r1.37
--- openacs-4/packages/acs-content-repository/sql/postgresql/content-item.sql	9 Dec 2001 04:21:58 -0000	1.36
+++ openacs-4/packages/acs-content-repository/sql/postgresql/content-item.sql	10 Feb 2002 22:11:31 -0000	1.37
@@ -945,7 +945,7 @@
   child_id                       integer;       
   start_pos                      integer default 1;        
   end_pos                        integer;       
-  counter                        integer default 0;       
+  counter                        integer default 1;
   item_name                      varchar;  
 begin
 
@@ -967,12 +967,13 @@
 
   LOOP
 
-    end_pos := instr(v_item_path, ''/'', start_pos);
+    end_pos := instr(v_item_path, ''/'', 1, counter);
 
     if end_pos = 0 then
       item_name := substr(v_item_path, start_pos);
     else
       item_name := substr(v_item_path, start_pos, end_pos - start_pos);
+      counter := counter + 1;
     end if;
 
     select 
