Index: openacs-4/packages/acs-kernel/sql/postgresql/upgrade/upgrade-5.3.0b1-5.3.0b2.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-kernel/sql/postgresql/upgrade/upgrade-5.3.0b1-5.3.0b2.sql,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/acs-kernel/sql/postgresql/upgrade/upgrade-5.3.0b1-5.3.0b2.sql	15 Apr 2007 11:09:04 -0000	1.1
+++ openacs-4/packages/acs-kernel/sql/postgresql/upgrade/upgrade-5.3.0b1-5.3.0b2.sql	16 Apr 2007 07:02:12 -0000	1.2
@@ -1,2 +1,12 @@
-create index acs_permissions_object_id_idx on acs_permissions(object_id); 
+create or replace function inline_0() returns integer as '
+declare v_exists integer;
+begin
+select into v_exists count(*) from pg_class where relname = ''acs_permissions_object_id_idx'';
+if v_exists = 0 then
+create index acs_permissions_object_id_idx on acs_permissions(object_id);
+end if;
+return null;
+end;' language 'plpgsql';
+select inline_0();
+drop function inline_0();
 
