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.69 -r1.70
--- openacs-4/packages/acs-kernel/sql/postgresql/acs-objects-create.sql	24 Dec 2017 13:10:50 -0000	1.69
+++ openacs-4/packages/acs-kernel/sql/postgresql/acs-objects-create.sql	21 Feb 2018 14:00:56 -0000	1.70
@@ -817,7 +817,16 @@
 DECLARE
   obj_type record;
 BEGIN
-  
+
+   -- Also child relationships must be deleted. On delete cascade
+   -- would not help here, as only tuple in acs_rels would go, while
+   -- related acs_object would stay.
+   PERFORM acs_object__delete(object_id)
+     from acs_objects where object_id in
+     (select rel_id from acs_rels where
+          object_id_one = delete__object_id or
+          object_id_two = delete__object_id);
+
   -- GN: the following deletion operation iterates over the id_columns
   -- of the acs_object_types of the type tree for the object and
   -- performs manual deletions in these tables by trying to delete the
