-- -- calendar__delete/1 -- create or replace function calendar__delete( integer ) returns int4 as $$ declare delete__calendar_id alias for $1; begin delete from calendars where calendar_id = delete__calendar_id; -- Delete all privileges associate with this calendar delete from acs_permissions where object_id = delete__calendar_id; delete from acs_permissions where object_id in ( select cal_item_id from cal_items where on_which_calendar = delete__calendar_id ); PERFORM acs_object__delete(delete__calendar_id); return 0; end;$$ language plpgsql;