Index: openacs-4/contrib/obsolete-packages/bboard/tcl/bboard-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/tcl/bboard-procs.tcl,v diff -u -N -r1.6 -r1.7 --- openacs-4/contrib/obsolete-packages/bboard/tcl/bboard-procs.tcl 31 Oct 2001 20:42:07 -0000 1.6 +++ openacs-4/contrib/obsolete-packages/bboard/tcl/bboard-procs.tcl 30 Nov 2001 00:50:22 -0000 1.7 @@ -999,22 +999,17 @@ Works around postgresql bugs that make it impossible to delete multiple items in a single transaction - WARNING The Postgres version of these queries - assume that acs-messaging is only used by bboard - and general-comments, and will delete entries made - by any other package. - If this poses a problem, revisit the oracle queries - and port the CONNECT BY query faithfully. + DRB fixed the assumption that only general-comments and bboard use acs_messaging + } { db_foreach get_orphans { - select object_id as message_id - from acs_objects - where object_type = 'acs_message' - and object_id not in (select message_id - from bboard_forum_message_map - union - select comment_id - from general_comments) + select object_id as message_id + from acs_objects o + where o.object_type = 'acs_message' + and not exists (select 1 + from bboard_forum_message_map bfmm, acs_objects o2 + where o2.object_id = bfmm.message_id and + o.tree_sortkey between o2.tree_sortkey and tree_right(o2.tree_sortkey)) } { db_dml clear_revision_references { update cr_items