Index: openacs-4/packages/forums/sql/postgresql/forums-messages-package-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/forums/sql/postgresql/forums-messages-package-create.sql,v
diff -u -N -r1.7 -r1.8
--- openacs-4/packages/forums/sql/postgresql/forums-messages-package-create.sql	5 Aug 2002 20:00:09 -0000	1.7
+++ openacs-4/packages/forums/sql/postgresql/forums-messages-package-create.sql	20 Aug 2002 21:39:42 -0000	1.8
@@ -182,25 +182,25 @@
     where message_id = p_message_id;
            
     -- if it is already deleted
-    if NOTFOUND
+    if v_forum_id is null
     then return 0;
     end if;
 
     -- delete all children
     -- order by tree_sortkey desc to guarantee
     -- that we never delete a parent before its child
     -- sortkeys are beautiful
-    for v_message in (select *
-                      from forums_messages
-                      where forum_id = v_forum_id
-                      and tree_sortkey between tree_left(v_sortkey) and tree_right(v_sortkey)
-                      order by tree_sortkey desc)
+    for v_message in select *
+                     from forums_messages
+                     where forum_id = v_forum_id
+                     and tree_sortkey between tree_left(v_sortkey) and tree_right(v_sortkey)
+                     order by tree_sortkey desc
     loop
         perform forums_message__delete(v_message.message_id);
     end loop;
 
     -- delete the message itself
-    perform forums_message.delete(p_message_id);
+    perform forums_message__delete(p_message_id);
 
     return 0;
 end;
