Index: openacs-4/packages/acs-subsite/tcl/subsite-callback-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/tcl/subsite-callback-procs-postgresql.xql,v diff -u -r1.3 -r1.4 --- openacs-4/packages/acs-subsite/tcl/subsite-callback-procs-postgresql.xql 4 Dec 2001 00:20:47 -0000 1.3 +++ openacs-4/packages/acs-subsite/tcl/subsite-callback-procs-postgresql.xql 3 Sep 2024 15:37:33 -0000 1.4 @@ -1,22 +1,30 @@ - postgresql7.1 + postgresql9.6 + - - + + + with recursive object_hierarchy(object_type, supertype) as ( + select object_type, supertype + from acs_object_types + where object_type = coalesce(:object_type, (select object_type + from acs_objects + where object_id = :object_id)) - select distinct callback, callback_type - from subsite_callbacks - where object_type in (select t2.object_type - from acs_object_types t1, acs_object_types t2 - where t2.tree_sortkey <= t1.tree_sortkey - and t1.tree_sortkey between t2.tree_sortkey and tree_right(t2.tree_sortkey) - and t1.object_type = :object_type) - and event_type = :event_type - - + union all + + select t.object_type, t.supertype + from acs_object_types t, + object_hierarchy s + where t.object_type = s.supertype + ) + select distinct callback, callback_type as type + from subsite_callbacks + where event_type = :event_type + and object_type in (select object_type from object_hierarchy) + -