Index: openacs-4/packages/edit-this-page/sql/postgresql/edit-this-page-drop.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/edit-this-page/sql/postgresql/edit-this-page-drop.sql,v
diff -u -r1.3 -r1.4
--- openacs-4/packages/edit-this-page/sql/postgresql/edit-this-page-drop.sql	16 Nov 2001 03:11:08 -0000	1.3
+++ openacs-4/packages/edit-this-page/sql/postgresql/edit-this-page-drop.sql	12 Feb 2002 00:02:13 -0000	1.4
@@ -44,17 +44,19 @@
 select inline_0 ();
 drop function inline_0 ();
 
--- this will error if any deleted content exists
+-- although we don't attempt to delete content that was
+-- added via ETP, in order to delete the package we must
+-- remove the package reference from cr_folders that were
+-- created by ETP
+update cr_folders set package_id = null
+where package_id in (select package_id 
+                       from apm_packages
+                      where package_key = 'edit-this-page');
 
-create function inline_1 () 
-returns integer as '
-begin
-perform content_folder__delete (
-    -400
-  );
-return 0;
-end;
-' language 'plpgsql';
-select inline_1 ();
-drop function inline_1 ();
+-- also kill the package reference in the context_id field
+-- of ETP content
+update acs_objects set context_id = 0
+where context_id in (select package_id 
+                       from apm_packages
+                      where package_key = 'edit-this-page');
 
