Index: openacs-4/packages/faq/sql/postgresql/faq-drop.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/faq/sql/postgresql/faq-drop.sql,v
diff -u -r1.4 -r1.5
--- openacs-4/packages/faq/sql/postgresql/faq-drop.sql	7 Oct 2007 22:37:00 -0000	1.4
+++ openacs-4/packages/faq/sql/postgresql/faq-drop.sql	12 Aug 2013 09:34:30 -0000	1.5
@@ -24,24 +24,30 @@
 delete from acs_permissions where object_id in (select faq_id from faqs);
 
 
-create function inline_0()
-returns integer as '
-declare
+
+
+--
+-- procedure inline_0/0
+--
+CREATE OR REPLACE FUNCTION inline_0(
+
+) RETURNS integer AS $$
+DECLARE
 	object_rec		record;
   default_context 	acs_objects.object_id%TYPE;
   registered_users 	acs_objects.object_id%TYPE;
   the_public 				acs_objects.object_id%TYPE;
-begin
+BEGIN
 
 
 	--drop objects
 
-	for object_rec in select object_id from acs_objects where object_type=''faq''
+	for object_rec in select object_id from acs_objects where object_type='faq'
 	loop
 		PERFORM acs_object__delete( object_rec.object_id );
 	end loop;
 
-	for object_rec in select object_id from acs_objects where object_type=''faq_q_and_a''
+	for object_rec in select object_id from acs_objects where object_type='faq_q_and_a'
 	loop
 		PERFORM acs_object__delete( object_rec.object_id );
 	end loop;
@@ -50,55 +56,56 @@
 
 -- bind privileges to global names
 
-  default_context := acs__magic_object_id(''default_context'');
-  registered_users := acs__magic_object_id(''registered_users'');
-  the_public := acs__magic_object_id(''the_public'');
+  default_context := acs__magic_object_id('default_context');
+  registered_users := acs__magic_object_id('registered_users');
+  the_public := acs__magic_object_id('the_public');
 
   -- revoke from the public the power to view faqs
 
-  PERFORM acs_permission__revoke_permission (default_context, the_public, ''faq_view_faq'');
+  PERFORM acs_permission__revoke_permission (default_context, the_public, 'faq_view_faq');
 
 
   -- revoke from the public the power to view q_and_as
 
-  PERFORM acs_permission__revoke_permission ( default_context,the_public, ''faq_view_q_and_a'');
+  PERFORM acs_permission__revoke_permission ( default_context,the_public, 'faq_view_q_and_a');
 
 
 
 --drop permissions
-	PERFORM acs_privilege__remove_child(''create'',''faq_create_faq'');
-	PERFORM acs_privilege__remove_child(''create'',''faq_create_q_and_a'');
-	PERFORM acs_privilege__remove_child(''write'',''faq_modify_faq'');
-	PERFORM acs_privilege__remove_child(''write'',''faq_modify_q_and_a'');
-	PERFORM acs_privilege__remove_child(''read'',''faq_view_faq'');
-	PERFORM acs_privilege__remove_child(''read'',''faq_view_q_and_a'');
-	PERFORM acs_privilege__remove_child(''delete'',''faq_delete_faq'');
-	PERFORM acs_privilege__remove_child(''delete'',''faq_delete_q_and_a'');
-	PERFORM acs_privilege__remove_child(''admin'',''faq_admin_faq'');
+	PERFORM acs_privilege__remove_child('create','faq_create_faq');
+	PERFORM acs_privilege__remove_child('create','faq_create_q_and_a');
+	PERFORM acs_privilege__remove_child('write','faq_modify_faq');
+	PERFORM acs_privilege__remove_child('write','faq_modify_q_and_a');
+	PERFORM acs_privilege__remove_child('read','faq_view_faq');
+	PERFORM acs_privilege__remove_child('read','faq_view_q_and_a');
+	PERFORM acs_privilege__remove_child('delete','faq_delete_faq');
+	PERFORM acs_privilege__remove_child('delete','faq_delete_q_and_a');
+	PERFORM acs_privilege__remove_child('admin','faq_admin_faq');
 
-	PERFORM acs_privilege__remove_child(''faq_admin_faq'', ''faq_view_faq'');
-	PERFORM acs_privilege__remove_child(''faq_admin_faq'', ''faq_create_faq'');
-	PERFORM acs_privilege__remove_child(''faq_admin_faq'', ''faq_delete_faq'');
-	PERFORM acs_privilege__remove_child(''faq_admin_faq'', ''faq_modify_faq'');
-	PERFORM acs_privilege__remove_child(''faq_admin_q_and_a'', ''faq_view_q_and_a'');
-	PERFORM acs_privilege__remove_child(''faq_admin_q_and_a'', ''faq_create_q_and_a'');
-	PERFORM acs_privilege__remove_child(''faq_admin_q_and_a'', ''faq_delete_q_and_a'');
-	PERFORM acs_privilege__remove_child(''faq_admin_q_and_a'', ''faq_modify_q_and_a'');
-	PERFORM acs_privilege__remove_child(''faq_admin_faq'', ''faq_admin_q_and_a'');
+	PERFORM acs_privilege__remove_child('faq_admin_faq', 'faq_view_faq');
+	PERFORM acs_privilege__remove_child('faq_admin_faq', 'faq_create_faq');
+	PERFORM acs_privilege__remove_child('faq_admin_faq', 'faq_delete_faq');
+	PERFORM acs_privilege__remove_child('faq_admin_faq', 'faq_modify_faq');
+	PERFORM acs_privilege__remove_child('faq_admin_q_and_a', 'faq_view_q_and_a');
+	PERFORM acs_privilege__remove_child('faq_admin_q_and_a', 'faq_create_q_and_a');
+	PERFORM acs_privilege__remove_child('faq_admin_q_and_a', 'faq_delete_q_and_a');
+	PERFORM acs_privilege__remove_child('faq_admin_q_and_a', 'faq_modify_q_and_a');
+	PERFORM acs_privilege__remove_child('faq_admin_faq', 'faq_admin_q_and_a');
 
-  	PERFORM acs_privilege__drop_privilege(''faq_view_faq'');
-	PERFORM acs_privilege__drop_privilege(''faq_create_faq'');
-	PERFORM acs_privilege__drop_privilege(''faq_delete_faq'');
-	PERFORM acs_privilege__drop_privilege(''faq_modify_faq'');
-	PERFORM acs_privilege__drop_privilege(''faq_view_q_and_a'');
-	PERFORM acs_privilege__drop_privilege(''faq_create_q_and_a'');
-	PERFORM acs_privilege__drop_privilege(''faq_delete_q_and_a'');
-	PERFORM acs_privilege__drop_privilege(''faq_modify_q_and_a'');
-	PERFORM acs_privilege__drop_privilege(''faq_admin_faq'');
-	PERFORM acs_privilege__drop_privilege(''faq_admin_q_and_a'');
+  	PERFORM acs_privilege__drop_privilege('faq_view_faq');
+	PERFORM acs_privilege__drop_privilege('faq_create_faq');
+	PERFORM acs_privilege__drop_privilege('faq_delete_faq');
+	PERFORM acs_privilege__drop_privilege('faq_modify_faq');
+	PERFORM acs_privilege__drop_privilege('faq_view_q_and_a');
+	PERFORM acs_privilege__drop_privilege('faq_create_q_and_a');
+	PERFORM acs_privilege__drop_privilege('faq_delete_q_and_a');
+	PERFORM acs_privilege__drop_privilege('faq_modify_q_and_a');
+	PERFORM acs_privilege__drop_privilege('faq_admin_faq');
+	PERFORM acs_privilege__drop_privilege('faq_admin_q_and_a');
   			
 	return 0;
-end;' language 'plpgsql';
+END;
+$$ LANGUAGE plpgsql;
 
 select inline_0();
 
