-- -- content_folder__unregister_content_type/3 -- create or replace function content_folder__unregister_content_type( integer, character varying, boolean ) returns int4 as $$ declare unregister_content_type__folder_id alias for $1; unregister_content_type__content_type alias for $2; unregister_content_type__include_subtypes alias for $3; -- default 'f' begin if unregister_content_type__include_subtypes = 'f' then delete from cr_folder_type_map where folder_id = unregister_content_type__folder_id and content_type = unregister_content_type__content_type; else -- delete from cr_folder_type_map -- where folder_id = unregister_content_type__folder_id -- and content_type in (select object_type -- from acs_object_types -- where object_type <> 'acs_object' -- connect by prior object_type = supertype -- start with -- object_type = unregister_content_type__content_type); delete from cr_folder_type_map where folder_id = unregister_content_type__folder_id and content_type in (select o.object_type from acs_object_types o, acs_object_types o2 where o.object_type <> 'acs_object' and o2.object_type = unregister_content_type__content_type and o.tree_sortkey between o2.tree_sortkey and tree_right(o2.tree_sortkey)); end if; return 0; end;$$ language plpgsql;