-- -- acs_event__delete/1 -- create or replace function acs_event__delete( integer ) returns int4 as $$ declare delete__event_id alias for $1; v_recurrence_id acs_events.recurrence_id%TYPE; begin select recurrence_id into v_recurrence_id from acs_events where event_id = delete__event_id; -- acs_events and acs_event_party_map deleted via on delete cascade PERFORM acs_object__delete(delete__event_id); -- Check for no more instances and delete recurrence if exists if not acs_event__instances_exist_p(v_recurrence_id) then PERFORM recurrence__delete(v_recurrence_id); end if; return 0; end;$$ language plpgsql;