Index: openacs-4/packages/file-storage/sql/postgresql/upgrade/upgrade-5.1.0a6-5.1.0a7.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/sql/postgresql/upgrade/upgrade-5.1.0a6-5.1.0a7.sql,v
diff -u -r1.2 -r1.3
--- openacs-4/packages/file-storage/sql/postgresql/upgrade/upgrade-5.1.0a6-5.1.0a7.sql	13 Jan 2005 13:58:11 -0000	1.2
+++ openacs-4/packages/file-storage/sql/postgresql/upgrade/upgrade-5.1.0a6-5.1.0a7.sql	24 Feb 2005 13:33:18 -0000	1.3
@@ -50,8 +50,7 @@
 	   update cr_revisions set title=v_item_row.name
 		where revision_id=v_item_row.revision_id;
 
-           if v_item_row.parent_id = v_prev_parent_id
-             and v_item_row.title = v_prev_title then
+	if (select 1 from cr_items where name=v_item_row.title and parent_id = v_item_row.parent_id) then
 
              --Name collision: change file.ext to file.n.ext
 
