Index: openacs-4/packages/workflow/sql/postgresql/workflow-procedural-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/workflow/sql/postgresql/workflow-procedural-create.sql,v
diff -u -r1.9 -r1.10
--- openacs-4/packages/workflow/sql/postgresql/workflow-procedural-create.sql	11 Dec 2003 21:40:15 -0000	1.9
+++ openacs-4/packages/workflow/sql/postgresql/workflow-procedural-create.sql	9 Jan 2004 15:47:53 -0000	1.10
@@ -153,10 +153,12 @@
     where  action_id = p_action_id;
 
     -- use case object as context_id
-    select object_id
+    select top.object_id
     into   v_case_object_id
-    from   workflow_cases
-    where  case_id = p_case_id;
+    from   workflow_cases c, 
+           workflow_cases top
+    where  top.case_id = c.top_case_id
+    and    c.case_id = p_case_id;
 
     -- build the unique name
     if p_item_id is not null then
