Index: openacs-4/packages/fs-portlet/sql/postgresql/upgrade/upgrade-2.0.3-2.0.4.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/fs-portlet/sql/postgresql/upgrade/upgrade-2.0.3-2.0.4.sql,v
diff -u -r1.3 -r1.4
--- openacs-4/packages/fs-portlet/sql/postgresql/upgrade/upgrade-2.0.3-2.0.4.sql	24 Jul 2004 08:34:22 -0000	1.3
+++ openacs-4/packages/fs-portlet/sql/postgresql/upgrade/upgrade-2.0.3-2.0.4.sql	13 Jan 2005 13:58:20 -0000	1.4
@@ -5,31 +5,31 @@
 -- fs_contents_portlets get renamed properly.
 --
 
-create or replace trigger fs_cont_port_fldr_rnme_tr
-after update on cr_folders
-for each row
+create or replace function fold_rename() returns trigger as '
+declare
+  row_res record;
 begin
 
-  if :old.label <> :new.label then
-
-    for row in (select m.element_id
+  if old.label <> new.label then
+    for row_res in select m.element_id
                 from portal_element_map m,
                 portal_element_parameters p
-  	      where p.key = 'folder_id'
-                  and p.value = :new.folder_id
+  	        where p.key = ''folder_id''
+                  and p.value = new.folder_id
                   and m.element_id = p.element_id
-                  and m.name = 'fs_contents_portlet') loop
+                  and m.name = ''fs_contents_portlet'' loop
   
       update portal_element_map
-      set pretty_name = :new.label
-      where element_id = row.element_id;
+      set pretty_name = new.label
+      where element_id = row_res.element_id;
   
     end loop;
-
 end if;
+return new;
+end; ' language 'plpgsql';
 
-end fs_cont_port_fldr_rnme_tr;
-/
-show errors
+create trigger fs_cont_port_fldr_rnme_tr
+after update on cr_folders for each row
+execute procedure fold_rename();
 
 \i ../fs-admin-portlet-create.sql
\ No newline at end of file
