Index: openacs-4/packages/acs-kernel/sql/postgresql/upgrade/upgrade-5.9.1d3-5.9.1d4.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-kernel/sql/postgresql/upgrade/upgrade-5.9.1d3-5.9.1d4.sql,v
diff -u -r1.1.2.1 -r1.1.2.2
--- openacs-4/packages/acs-kernel/sql/postgresql/upgrade/upgrade-5.9.1d3-5.9.1d4.sql	29 Apr 2016 07:56:56 -0000	1.1.2.1
+++ openacs-4/packages/acs-kernel/sql/postgresql/upgrade/upgrade-5.9.1d3-5.9.1d4.sql	8 Jul 2016 15:59:41 -0000	1.1.2.2
@@ -6,8 +6,11 @@
    select setting from pg_settings where name='server_version_num' and setting::int >= 90200 into v_dummy;
    IF found THEN
 
-      	drop view IF EXISTS anon_func_seq;
-   	ALTER SEQUENCE IF EXISTS t_anon_func_seq RENAME TO anon_func_seq;
+        select 1 from pg_views where viewname = 'anon_func_seq' into v_dummy;
+	IF v_dummy THEN
+      	   drop view IF EXISTS anon_func_seq;
+   	   ALTER SEQUENCE IF EXISTS t_anon_func_seq RENAME TO anon_func_seq;
+	END IF;
 
    ELSE
 	-- verison earlier than 9.2, no "IF EXISTS"
