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.3 -r1.1.2.4
--- openacs-4/packages/acs-kernel/sql/postgresql/upgrade/upgrade-5.9.1d3-5.9.1d4.sql	8 Jul 2016 16:02:31 -0000	1.1.2.3
+++ openacs-4/packages/acs-kernel/sql/postgresql/upgrade/upgrade-5.9.1d3-5.9.1d4.sql	14 Jul 2016 15:49:37 -0000	1.1.2.4
@@ -7,17 +7,17 @@
    IF found THEN
 
         select 1 from pg_views where viewname = 'anon_func_seq' into v_dummy;
-	IF v_dummy THEN
+	IF found 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"
         select 1 from pg_views where viewname = 'anon_func_seq' into v_dummy;
-	IF v_dummy THEN
+	IF found THEN
 	   drop view anon_func_seq;
-      	   ALTER SEQUENCE IF EXISTS t_anon_func_seq RENAME TO anon_func_seq;
+      	   ALTER SEQUENCE t_anon_func_seq RENAME TO anon_func_seq;
 	END IF;
 
    END IF;
