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.4 -r1.5 --- openacs-4/packages/acs-kernel/sql/postgresql/rel-constraints-create.sql 15 Mar 2001 01:37:48 -0000 1.4 +++ openacs-4/packages/acs-kernel/sql/postgresql/rel-constraints-create.sql 18 Mar 2001 05:22:27 -0000 1.5 @@ -217,28 +217,6 @@ rspm.party_id = c.container_id) where rspm.party_id is null; - --- Originally, we tried this view. It was slow. The one above is much --- less slow. It moves the "not exists" query to an outer join, checking --- for null rows in the outer join table. This turns out to be much faster --- than "not exists". --- --- create or replace view rel_constraints_violated_one as --- select rel_constraints.constraint_id, rel_constraints.constraint_name, --- r.rel_id, r.container_id, r.party_id, r.rel_type, --- rel_constraints.rel_segment, --- rel_constraints.rel_side, --- rel_constraints.required_rel_segment --- from rel_constraints, rel_segment_party_map r --- where rel_constraints.rel_side = 'one' --- and rel_constraints.rel_segment = r.segment_id --- and not exists ( --- select 1 from rel_segment_party_map rspm --- where rspm.segment_id = rel_constraints.required_rel_segment --- and rspm.party_id = r.container_id --- ); - - -- View rel_constraints_violated_two -- -- pseudo sql: @@ -282,28 +260,7 @@ rspm.party_id = c.party_id) where rspm.party_id is null; --- Originally, we tried this view. It was slow. The one above is much --- less slow. It moves the "not exists" query to an outer join, checking --- for null rows in the outer join table. This turns out to be much faster --- than "not exists". --- --- create or replace view rel_constraints_violated_two as --- select rel_constraints.constraint_id, rel_constraints.constraint_name, --- r.rel_id, r.container_id, r.party_id, r.rel_type, --- rel_constraints.rel_segment, --- rel_constraints.rel_side, --- rel_constraints.required_rel_segment --- from rel_constraints, rel_segment_party_map r --- where rel_constraints.rel_side = 'two' --- and rel_constraints.rel_segment = r.segment_id --- and not exists ( --- select 1 from rel_segment_party_map rspm --- where rspm.segment_id = rel_constraints.required_rel_segment --- and rspm.party_id = r.party_id --- ); - - -- View: rc_all_constraints -- -- Question: Given group :group_id and rel_type :rel_type . . . @@ -476,8 +433,11 @@ group_rel_type_combos.rel_type, parties.party_id from (rc_required_rel_segments right outer join group_rel_type_combos - on (rc_required_rel_segments.group_id = group_rel_type_combos.group_id and - rc_required_rel_segments.rel_type = group_rel_type_combos.rel_type)), parties + on + (rc_required_rel_segments.group_id = group_rel_type_combos.group_id + and + rc_required_rel_segments.rel_type = group_rel_type_combos.rel_type)), + parties where rc_required_rel_segments.group_id is null;