Index: openacs-4/packages/acs-object-management/sql/postgresql/acs-views-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-object-management/sql/postgresql/acs-views-create.sql,v
diff -u -N -r1.2 -r1.3
--- openacs-4/packages/acs-object-management/sql/postgresql/acs-views-create.sql	13 Mar 2011 22:56:22 -0000	1.2
+++ openacs-4/packages/acs-object-management/sql/postgresql/acs-views-create.sql	5 Jun 2011 21:21:14 -0000	1.3
@@ -149,7 +149,7 @@
                     and ot1.tree_sortkey between ot2.tree_sortkey and tree_right(ot2.tree_sortkey)
                   order by ot2.tree_sortkey desc
   loop
-    if v_join_rec.table_name is not null then
+    if v_join_rec.table_name is not null and table_exists(v_join_rec.table_name) then
 
       if not v_tree_sortkey_found_p and column_exists(v_join_rec.table_name, ''tree_sortkey'') then
         v_cols := v_cols || '','' || v_join_rec.table_name || ''.tree_sortkey'';
