Index: openacs-4/packages/acs-kernel/sql/postgresql/rel-constraints-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-kernel/sql/postgresql/rel-constraints-create.sql,v diff -u -r1.7 -r1.8 --- openacs-4/packages/acs-kernel/sql/postgresql/rel-constraints-create.sql 17 Apr 2001 23:41:36 -0000 1.7 +++ openacs-4/packages/acs-kernel/sql/postgresql/rel-constraints-create.sql 18 Apr 2001 05:20:54 -0000 1.8 @@ -77,12 +77,12 @@ begin select max(tree_sortkey) into max_key from rel_constraints - where rel_segment = new.rel_segment + where required_rel_segment = new.required_rel_segment and rel_side = new.rel_side; select coalesce(max(tree_sortkey),'''') into v_parent_sk from rel_constraints - where required_rel_segment = new.rel_segment + where rel_segment = new.required_rel_segment and rel_side = new.rel_side; new.tree_sortkey := v_parent_sk || ''/'' || tree_next_key(max_key); @@ -602,16 +602,29 @@ -- and prior rel_side = 'two' -- ); +-- FIXME: note this view doesn't match acsclassic, but from the description +-- above, I believe that this view is correct. The results from the +-- acsclassic version of this view make no sense - DCW 2001-04-18. + +-- drop view rc_segment_required_seg_map; create view rc_segment_required_seg_map as select rc.rel_segment, rc.rel_side, rc_required.required_rel_segment from rel_constraints rc, rel_constraints rc_required -where rc.rel_segment in (select c2.rel_segment - from rel_constraints c1, rel_constraints c2 - where c2.rel_side = 'two' - and c1.rel_side = 'two' - and c1.rel_segment = rc_required.rel_segment - and c2.tree_sortkey <= c1.tree_sortkey - and c1.tree_sortkey like (c2.tree_sortkey || '%')); +where rc.rel_side = rc_required.rel_side + and ((rc.rel_segment in (select rel_segment + from rel_constraints + where rel_side = 'two' + and tree_sortkey + like (select tree_sortkey || '%' + from rel_constraints + where rel_segment = rc_required.rel_segment and rel_side = 'two'))) + or (rc.rel_segment in (select rel_segment + from rel_constraints + where rel_side = 'one' + and tree_sortkey + like (select tree_sortkey || '%' + from rel_constraints + where rel_segment = rc_required.rel_segment and rel_side = 'one')))); -- View: rc_segment_dependency_levels -- Index: openacs-4/packages/acs-kernel/sql/postgresql/rel-segments-body-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-kernel/sql/postgresql/rel-segments-body-create.sql,v diff -u -r1.4 -r1.5 --- openacs-4/packages/acs-kernel/sql/postgresql/rel-segments-body-create.sql 17 Apr 2001 23:41:36 -0000 1.4 +++ openacs-4/packages/acs-kernel/sql/postgresql/rel-segments-body-create.sql 18 Apr 2001 05:20:54 -0000 1.5 @@ -103,7 +103,7 @@ if v_segment_id is null then - if v_segment_name is not null then + if segment_name is not null then v_segment_name := segment_name; else select groups.group_name || '' - '' || acs_object_types.pretty_name || @@ -114,6 +114,7 @@ and acs_object_types.object_type = get_or_new__rel_type; end if; + raise notice ''segment name = %'', v_segment_name; v_segment_id := rel_segment__new ( null,