Index: openacs-4/packages/acs-kernel/sql/postgresql/acs-objects-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-kernel/sql/postgresql/acs-objects-create.sql,v diff -u -r1.7 -r1.8 --- openacs-4/packages/acs-kernel/sql/postgresql/acs-objects-create.sql 19 Mar 2001 05:07:08 -0000 1.7 +++ openacs-4/packages/acs-kernel/sql/postgresql/acs-objects-create.sql 20 Mar 2001 04:12:10 -0000 1.8 @@ -1086,7 +1086,7 @@ security_inherit_p acs_objects.security_inherit_p%TYPE; n_rows integer; n_gens integer; - result boolean; + res boolean; begin -- OBJECT_ID is the object we are verifying -- ANCESTOR_ID is the current ancestor we are tracking @@ -1098,7 +1098,7 @@ -- OBJECT_ID''''s children are contained in the index. That is -- verified by seperate functions. - result := ''t''; + res := ''t''; -- Grab the context and security_inherit_p flag of the current -- ancestor''''s parent. @@ -1108,29 +1108,29 @@ if check_object_ancestors__ancestor_id = 0 then if context_id is null then - result := ''t''; + res := ''t''; else -- This can be a constraint, can''''t it? PERFORM acs_log__error(''acs_object.check_representation'', ''Object 0 doesn''''t have a null context_id''); - result := ''f''; + res := ''f''; end if; else if context_id is null or security_inherit_p = ''f'' then context_id := 0; end if; if acs_object__check_context_index(check_object_ancestors__object_id, check_object_ancestors__ancestor_id, check_object_ancestors__n_generations) = ''f'' then - result := ''f''; + res := ''f''; end if; if acs_object__check_object_ancestors(check_object_ancestors__object_id, context_id, check_object_ancestors__n_generations + 1) = ''f'' then - result := ''f''; + res := ''f''; end if; end if; - return result; + return res; end;' language 'plpgsql'; @@ -1142,7 +1142,7 @@ object_id alias for $1; descendant_id alias for $2; n_generations alias for $3; - result boolean; + res boolean; obj record; begin -- OBJECT_ID is the object we are verifying. @@ -1155,12 +1155,12 @@ -- there aren''t extraneous rows or that the ancestors of OBJECT_ID -- are maintained correctly. - result := ''t''; + res := ''t''; -- First verify that OBJECT_ID and DESCENDANT_ID are actually in -- the index. if acs_object__check_context_index(descendant_id, object_id, n_generations) = ''f'' then - result := ''f''; + res := ''f''; end if; -- For every child that reports inheriting from OBJECT_ID we need to call @@ -1171,11 +1171,11 @@ and security_inherit_p = ''t'' loop if acs_object__check_object_descendants(object_id, obj.object_id, n_generations + 1) = ''f'' then - result := ''f''; + res := ''f''; end if; end loop; - return result; + return res; end;' language 'plpgsql'; @@ -1186,22 +1186,28 @@ declare check_path__object_id alias for $1; check_path__ancestor_id alias for $2; - context_id acs_objects.context_id%TYPE; - security_inherit_p acs_objects.security_inherit_p%TYPE; + check_path__context_id acs_objects.context_id%TYPE; + check_path__security_inherit_p acs_objects.security_inherit_p%TYPE; begin if check_path__object_id = check_path__ancestor_id then return ''t''; end if; - select context_id, security_inherit_p into context_id, security_inherit_p + if check_path__object_id = 0 then + return ''f''; + end if; + + select context_id, security_inherit_p + into check_path__context_id, check_path__security_inherit_p from acs_objects where object_id = check_path__object_id; - if context_id is null or security_inherit_p = ''f'' then - context_id := 0; + if check_path__context_id is null or check_path__security_inherit_p = ''f'' + then + check_path__context_id := 0; end if; - return acs_object__check_path(context_id, check_path__ancestor_id); + return acs_object__check_path(check_path__context_id, check_path__ancestor_id); end;' language 'plpgsql'; @@ -1211,13 +1217,13 @@ returns boolean as ' declare check_representation__object_id alias for $1; - result boolean; + res boolean; check_representation__object_type acs_objects.object_type%TYPE; n_rows integer; v_rec record; row record; begin - result := ''t''; + res := ''t''; PERFORM acs_log__notice(''acs_object.check_representation'', ''Running acs_object.check_representation on object_id = '' || check_representation__object_id || ''.''); @@ -1246,7 +1252,7 @@ end LOOP; if n_rows = 0 then - result := ''f''; + res := ''f''; PERFORM acs_log__error(''acs_object.check_representation'', ''Table '' || v_rec.table_name || '' (primary storage for '' || @@ -1262,32 +1268,32 @@ ''OBJECT CONTEXT INTEGRITY TEST''); if acs_object__check_object_ancestors(check_representation__object_id, check_representation__object_id, 0) = ''f'' then - result := ''f''; + res := ''f''; end if; if acs_object__check_object_descendants(check_representation__object_id, check_representation__object_id, 0) = ''f'' then - result := ''f''; + res := ''f''; end if; - for row in select object_id, ancestor_id, n_generations from acs_object_context_index where object_id = check_representation__object_id - or ancestor_id = check_representation__object_id loop + or ancestor_id = check_representation__object_id + LOOP if acs_object__check_path(row.object_id, row.ancestor_id) = ''f'' then PERFORM acs_log__error(''acs_object.check_representation'', - ''acs_object_context_index contains an extraneous row: '' || - ''object_id = '' || row.object_id || '', ancestor_id = '' || - row.ancestor_id || '', n_generations = '' || - row.n_generations || ''.''); - result := ''f''; + ''acs_object_context_index contains an extraneous row: '' + || ''object_id = '' || row.object_id || + '', ancestor_id = '' || row.ancestor_id || + '', n_generations = '' || row.n_generations || ''.''); + res := ''f''; end if; end loop; PERFORM acs_log__notice(''acs_object.check_representation'', ''Done running acs_object.check_representation '' || ''on object_id = '' || check_representation__object_id || ''.''); - return result; + return res; end;' language 'plpgsql'; Index: openacs-4/packages/acs-kernel/sql/postgresql/groups-body-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-kernel/sql/postgresql/groups-body-create.sql,v diff -u -r1.4 -r1.5 --- openacs-4/packages/acs-kernel/sql/postgresql/groups-body-create.sql 19 Mar 2001 05:07:08 -0000 1.4 +++ openacs-4/packages/acs-kernel/sql/postgresql/groups-body-create.sql 20 Mar 2001 04:12:10 -0000 1.5 @@ -667,7 +667,6 @@ result := ''t''; if acs_object__check_representation(check_representation__rel_id) = ''f'' then - raise notice ''acs_object rep failed''; result := ''f''; end if; @@ -678,7 +677,6 @@ and m.rel_id = check_representation__rel_id; if membership_rel__check_index(group_id, member_id, group_id) = ''f'' then - raise notice ''check index failed''; result := ''f''; end if; @@ -689,7 +687,6 @@ if composition_rel__check_path_exists_p(row.container_id, row.group_id) = ''f'' then result := ''f''; - raise notice ''path exists failed''; PERFORM acs_log__error(''membership_rel.check_representation'', ''Extra row in group_member_index: '' || ''group_id = '' || row.group_id || '', '' || @@ -790,6 +787,7 @@ from rel_segments where group_id = delete__group_id LOOP + raise notice '' rel_segment_delete %'', row.package_name; PERFORM rel_segment__delete(row.segment_id); @@ -802,7 +800,8 @@ and (r.object_id_one = delete__group_id or r.object_id_two = delete__group_id) LOOP - execute ''perform '' || row.package_name || ''__delete('' || row.rel_id || '')''; + raise notice '' delete %'', row.package_name; + execute ''select '' || row.package_name || ''__delete('' || row.rel_id || '')''; end loop; PERFORM party__delete(delete__group_id); @@ -845,17 +844,16 @@ returns boolean as ' declare group_id alias for $1; - result boolean; + res boolean; comp record; memb record; begin - result := ''t''; + res := ''t''; PERFORM acs_log__notice(''acs_group.check_representation'', ''Running check_representation on group '' || group_id); if acs_object__check_representation(group_id) = ''f'' then - raise notice ''failed 1''; - result := ''f''; + res := ''f''; end if; for comp in select c.rel_id @@ -864,8 +862,7 @@ and r.object_id_one = group_id LOOP if composition_rel__check_representation(comp.rel_id) = ''f'' then - raise notice ''failed 2''; - result := ''f''; + res := ''f''; end if; end loop; @@ -875,15 +872,14 @@ and r.object_id_one = group_id LOOP if membership_rel__check_representation(memb.rel_id) = ''f'' then - raise notice ''failed 3''; - result := ''f''; + res := ''f''; end if; end loop; PERFORM acs_log__notice(''acs_group.check_representation'', ''Done running check_representation on group '' || group_id); - return result; + return res; end;' language 'plpgsql'; Index: openacs-4/packages/acs-kernel/sql/postgresql/groups-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-kernel/sql/postgresql/groups-create.sql,v diff -u -r1.3 -r1.4 --- openacs-4/packages/acs-kernel/sql/postgresql/groups-create.sql 18 Mar 2001 05:22:27 -0000 1.3 +++ openacs-4/packages/acs-kernel/sql/postgresql/groups-create.sql 20 Mar 2001 04:12:10 -0000 1.4 @@ -331,7 +331,7 @@ where component_id = group_contains_p__component_id and group_id = container_id LOOP - if group_contains_p(group_contains_p__group_id, map.group_id) = ''t'' then + if group_contains_p(group_contains_p__group_id, map.group_id, null) = ''t'' then return ''t''; end if; end loop; @@ -342,7 +342,7 @@ and rel_id = group_contains_p__rel_id and group_id = container_id LOOP - if group_contains_p(group_contains_p__group_id, map.group_id) = ''t'' then + if group_contains_p(group_contains_p__group_id, map.group_id, null) = ''t'' then return ''t''; end if; end loop; Index: openacs-4/packages/acs-kernel/sql/postgresql/rel-constraints-body-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-kernel/sql/postgresql/rel-constraints-body-create.sql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/acs-kernel/sql/postgresql/rel-constraints-body-create.sql 18 Mar 2001 04:44:51 -0000 1.1 +++ openacs-4/packages/acs-kernel/sql/postgresql/rel-constraints-body-create.sql 20 Mar 2001 04:12:10 -0000 1.2 @@ -135,6 +135,7 @@ violation_if_removed__rel_id alias for $1; v_count integer; v_error varchar(4000); + constraint_violated record; begin v_error := null; @@ -145,7 +146,7 @@ where r.rel_id = violation_if_removed__rel_id); if v_count > 0 then - -- some other relation depends on this one. Let''s build up a string + -- some other relation depends on this one. Lets build up a string -- of the constraints we are violating for constraint_violated in select constraint_id, constraint_name from rc_violations_by_removing_rel r