Index: openacs-4/packages/file-storage/sql/postgresql/upgrade/upgrade-4.6.3-5.0.0.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/sql/postgresql/upgrade/upgrade-4.6.3-5.0.0.sql,v
diff -u -N -r1.2 -r1.3
--- openacs-4/packages/file-storage/sql/postgresql/upgrade/upgrade-4.6.3-5.0.0.sql	12 Mar 2004 13:45:37 -0000	1.2
+++ openacs-4/packages/file-storage/sql/postgresql/upgrade/upgrade-4.6.3-5.0.0.sql	30 Mar 2013 22:50:45 -0000	1.3
@@ -12,51 +12,53 @@
     -- Create the (default) file_storage_object content type template
 
     template_id := content_template__new( 
-      ''file-storage-default'', -- name
-      ''<master>
+      'file-storage-default', -- name
+      '<master>
 <property name="title">@title;noquote@</property>
 <property name="context">@context;noquote@</property>
-@text;noquote@'',               -- text
+@text;noquote@',               -- text
       true                      -- is_live
     );
 
     -- Register the template for the file_storage_object content type
 
     perform content_type__register_template(
-      ''file_storage_object'', -- content_type
+      'file_storage_object', -- content_type
       template_id,             -- template_id
-      ''public'',              -- use_context
-      ''t''                    -- is_default
+      'public',              -- use_context
+      't'                    -- is_default
     );
 
     return null;
-end;' language 'plpgsql';
+END;
+$$ LANGUAGE plpgsql;
 
 select inline_0();
 drop function inline_0();
 
-create or replace function file_storage__new_version (
-       --
-       -- Create a new version of a file
-       -- Wrapper for content_revision__new
-       --
-       varchar,         -- cr_revisions.title%TYPE,
-       varchar,         -- cr_revisions.description%TYPE,
-       varchar,         -- cr_revisions.mime_type%TYPE,
-       integer,         -- cr_items.item_id%TYPE,
-       integer,         -- acs_objects.creation_user%TYPE,
-       varchar          -- acs_objects.creation_ip%TYPE
-) returns integer as '  -- cr_revisions.revision_id 
-declare
-        new_version__filename           alias for $1;
-        new_version__description        alias for $2;
-        new_version__mime_type          alias for $3;
-        new_version__item_id            alias for $4;
-        new_version__creation_user      alias for $5;
-        new_version__creation_ip        alias for $6;
+
+
+-- added
+select define_function_args('file_storage__new_version','filename,description,mime_type,item_id,creation_user,creation_ip');
+
+--
+-- procedure file_storage__new_version/6
+--
+CREATE OR REPLACE FUNCTION file_storage__new_version(
+   new_version__filename --         --
+       varchar,
+   new_version__description varchar,
+   new_version__mime_type varchar,
+   new_version__item_id integer,
+   new_version__creation_user integer,
+   new_version__creation_ip varchar
+
+) RETURNS integer AS $$
+-- cr_revisions.revision_id
+DECLARE
         v_revision_id                   cr_revisions.revision_id%TYPE;
         v_folder_id                     cr_items.parent_id%TYPE;
-begin
+BEGIN
         -- Create a revision
         v_revision_id := content_revision__new (
                           new_version__filename,        -- title
@@ -85,4 +87,5 @@
 
         return v_revision_id;
 
-end;' language 'plpgsql';
+END;
+$$ LANGUAGE plpgsql;
