postgresql7.1
begin
if :version_id = content_item__get_live_revision(:item_id)
then
PERFORM content_revision__delete(:version_id);
PERFORM content_item__set_live_revision(content_item__get_latest_revision(:item_id));
else
PERFORM content_revision__delete(:version_id);
end if;
return 0;
end;