Index: openacs-4/packages/acs-kernel/sql/postgresql/acs-objects-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-kernel/sql/postgresql/acs-objects-create.sql,v
diff -u -r1.41 -r1.42
--- openacs-4/packages/acs-kernel/sql/postgresql/acs-objects-create.sql	24 Aug 2003 00:27:45 -0000	1.41
+++ openacs-4/packages/acs-kernel/sql/postgresql/acs-objects-create.sql	25 Aug 2003 21:40:16 -0000	1.42
@@ -432,10 +432,10 @@
   for outer in select object_id from acs_object_context_index where 
                ancestor_id = old.object_id and object_id <> old.object_id loop
     for inner in select ancestor_id from acs_object_context_index where
-                 object_id = old.object_id loop
+                 object_id = old.object_id and ancestor_id <> old.object_id loop
       delete from acs_object_context_index
       where object_id = outer.object_id
-        and ancestor_id = inner.object_id;
+        and ancestor_id = inner.ancestor_id;
     end loop;
   end loop;
 
