Index: openacs-4/packages/acs-kernel/sql/postgresql/acs-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-kernel/sql/postgresql/acs-create.sql,v
diff -u -r1.21 -r1.22
--- openacs-4/packages/acs-kernel/sql/postgresql/acs-create.sql	10 Sep 2003 08:40:58 -0000	1.21
+++ openacs-4/packages/acs-kernel/sql/postgresql/acs-create.sql	6 Oct 2003 13:16:11 -0000	1.22
@@ -107,10 +107,21 @@
 returns integer as '
 declare
   remove_user__user_id                alias for $1;  
+  v_rec           record;
 begin
-    delete from users
-    where user_id = remove_user__user_id;
+    delete
+    from acs_permissions
+    where grantee_id = remove_user__user_id;
 
+    for v_rec in select rel_id
+                 from acs_rels
+                 where object_id_two = remove_user__user_id
+    loop
+        perform acs_rel__delete(v_rec.rel_id);
+    end loop;
+
+    perform acs_user__delete(remove_user__user_id);
+
     return 0; 
 end;' language 'plpgsql';
 
