Sayyiduna Ibn Abbas (may Allah be pleased with them both) said that an insane woman of a certain tribe who had committed adultery, and who was to be stoned, was passed by Sayyiduna Ali (may Allah be pleased with him). Sayyiduna Ali (may Allah be pleased with him) said to Sayyiduna Umar (may Allah be pleased with him): "O Commander of the Believers! Did you order that so-and-so be stoned?" He said: "Yes! I gave the order." Sayyiduna Ali (may Allah be pleased with him) said: "Do you not remember this saying of the Messenger of Allah (peace and blessings be upon him): 'The pen has been lifted from three: (1) the sleeper until he wakes up, (2) the child until he reaches puberty, (3) the insane person until he recovers'?" Sayyiduna Umar (may Allah be pleased with him) said: "Yes!" Then Sayyiduna Umar (may Allah be pleased with him) ordered that she be let go.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب السرقة / 17211