postgresql7.1 select mime_type from cr_revisions where item_id = :attach_id and revision_id = content_item__get_latest_revision (:attach_id) delete from images where image_id = content_item__get_latest_revision(:attach_id) select acs_message__delete_image(:attach_id); select acs_message__delete_file(:attach_id); begin perform content_extlink__delete(:attach_id); return 0; end;