Index: openacs-4/packages/acs-kernel/sql/postgresql/upgrade/upgrade-5.2.0d1-5.2.0d2.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-kernel/sql/postgresql/upgrade/upgrade-5.2.0d1-5.2.0d2.sql,v
diff -u -r1.3 -r1.3.2.1
--- openacs-4/packages/acs-kernel/sql/postgresql/upgrade/upgrade-5.2.0d1-5.2.0d2.sql	23 Feb 2005 10:07:01 -0000	1.3
+++ openacs-4/packages/acs-kernel/sql/postgresql/upgrade/upgrade-5.2.0d1-5.2.0d2.sql	2 Jan 2006 18:00:40 -0000	1.3.2.1
@@ -521,7 +521,6 @@
 end;' language 'plpgsql';
 
 drop function apm_package__new (integer,varchar,varchar,varchar,timestamptz,integer,varchar,integer);
-
 create or replace function apm_package__new (integer,varchar,varchar,varchar,timestamptz,integer,varchar,integer)
 returns integer as '
 declare
@@ -567,11 +566,6 @@
 	 v_instance_name := new__instance_name;
        end if;
 
-       update acs_objects
-       set title = v_instance_name,
-           package_id = v_package_id
-       where object_id = v_package_id;
-
        select package_type into v_package_type
        from apm_package_types
        where package_key = new__package_key;
@@ -581,6 +575,11 @@
        values
        (v_package_id, new__package_key, v_instance_name);
 
+       update acs_objects
+       set title = v_instance_name,
+           package_id = v_package_id
+       where object_id = v_package_id;
+
        if v_package_type = ''apm_application'' then
 	   insert into apm_applications
 	   (application_id)
