Index: openacs-4/packages/forums/sql/postgresql/upgrade/upgrade-1.1.1-1.1.2d1.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/forums/sql/postgresql/upgrade/upgrade-1.1.1-1.1.2d1.sql,v
diff -u -r1.2 -r1.3
--- openacs-4/packages/forums/sql/postgresql/upgrade/upgrade-1.1.1-1.1.2d1.sql	24 Feb 2005 13:33:20 -0000	1.2
+++ openacs-4/packages/forums/sql/postgresql/upgrade/upgrade-1.1.1-1.1.2d1.sql	8 Aug 2006 21:26:51 -0000	1.3
@@ -1,11 +1,35 @@
 update acs_permissions
  set privilege = 'read'
- where privilege = 'forum_read';
+ where privilege = 'forum_read'
+ and not exists (select 1 
+    from acs_permissions p1 
+    where p1.object_id = acs_permissions.object_id
+    and p1.grantee_id = acs_permissions.grantee_id
+    and p1.privilege = 'read');
 
+delete from acs_permissions
+  where privilege = 'forum_read';
+
 update acs_permissions
  set privilege = 'write'
- where privilege = 'forum_write';
+ where privilege = 'forum_write' 
+    and not exists (select 1
+    from acs_permissions p1
+    where p1.object_id = acs_permissions.object_id
+    and p1.grantee_id = acs_permissions.grantee_id
+    and p1.privilege = 'write');
 
+delete from acs_permissions
+  where privilege = 'forum_write';
+
 update acs_permissions
  set privilege = 'create'
- where privilege = 'forum_create';
\ No newline at end of file
+ where privilege = 'forum_create' 
+    and not exists (select 1
+    from acs_permissions p1
+    where p1.object_id = acs_permissions.object_id
+    and p1.grantee_id = acs_permissions.grantee_id
+    and p1.privilege = 'create');
+
+delete from acs_permissions
+  where privilege = 'forum_create';
