Germany is to allow the possible prosecution of a comedian who insulted Turkish President Recep Tayyip Erdogan on German television.