Index: openacs-4/packages/acs-subsite/tcl/relation-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/tcl/relation-procs-postgresql.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/acs-subsite/tcl/relation-procs-postgresql.xql 6 May 2001 21:40:21 -0000 1.1 +++ openacs-4/packages/acs-subsite/tcl/relation-procs-postgresql.xql 15 May 2001 16:59:00 -0000 1.2 @@ -6,36 +6,78 @@ - select rel_constraint__violation(:rel_id) - + select rel_constraint__violation(:rel_id) + - - + + + begin ${package_name}.delete(:rel_id); end; + + + + + + select case when exists (select 1 from rc_violations_by_removing_rel r where r.rel_id = :rel_id) then 1 else 0 end - - + + - - + + - + select case when exists - (select 1 from rc_valid_rel_types r - where r.group_id = :group_id + (select 1 from rc_valid_rel_types r + where r.group_id = :group_id and r.rel_type = :rel_type) then 1 else 0 end + + + + + + + + FIX ME OUTER JOIN +FIX ME CONNECT BY +FIX ME ROWNUM + select + pretty_name, object_type, level, indent, + case when valid_types.rel_type = null then 0 else 1 end as valid_p + from + (select + t.pretty_name, t.object_type, level, + replace(lpad(' ', (level - 1) * 4), + ' ', ' ') as indent, + rownum as tree_rownum + from + acs_object_types t + connect by + prior t.object_type = t.supertype + start with + t.object_type = :start_with ) types, + (select + rel_type + from + rc_valid_rel_types + where + group_id = :group_id ) valid_types + where + types.object_type = valid_types.rel_type(+) + order by tree_rownum + - +