Another interpretation of (Ecclesiastes 2:2): "Of laughter I said: It is mad!" Rabbi Aha said: Solomon said there are things over which the attribute of justice laughed. It is written (Deuteronomy 17:17): "He shall not multiply wives for himself," and it is written (1 Kings 11:3): "And he had seven hundred royal wives, etc." It is written (Deuteronomy 17:16): "He shall not multiply horses for himself," and it is written (1 Kings 5:6): "And Solomon had forty thousand stalls of horses." It is written (Deuteronomy 17:17): "And silver and gold he shall not greatly multiply for himself," and it is written (1 Kings 10:27): "And the king made silver, etc." But were they not stolen? Rabbi Yose bar Hanina said: They were like stones of ten cubits and like stones of eight cubits. Rabbi Shimon ben Yohai taught: Even the weights that were in the days of Solomon were of gold. (Ecclesiastes 2:2): "And of rejoicing, what does this do?" The Holy One, blessed be He, said to him: What is this crown doing in your hand? Get down from your throne. Immediately an angel descended in the likeness of Solomon and sat upon his throne, and Solomon went around among the synagogues and the houses of study, and he would say (Ecclesiastes 1:12): "I, Kohelet, was king over Israel in Jerusalem." But they would say to him: King Solomon is sitting on his throne, and you go about acting like a madman. And they would strike him with a reed and set before him a bowl of grits. In that hour Solomon said (Ecclesiastes 2:10): "And this was my portion from all my labor."
How an Angel Took Solomon's Throne and Crown
Midrash Tanchuma Buber, Achrei Mot 2:2
ד"א לשחוק אמרתי מהולל. אמר ר' אחא אמר שלמה דברים ששחקה עליהם מדת הדין, כתיב לא ירבה לו נשים (דברים יז יז), וכתיב ויהי לו נשים שרות שבע מ אות וגו' (מ"א יא ג), כתיב לא ירבה לו סוסים (דברים שם טז), וכתיב ויהי לשלמה ארבעים אלף אורות סוסים (מ"א ה ו), [כתיב] וכסף וזהב לא ירבה לו מאד (דברים יז), וכתיב ויתן המלך את הכסף וגו' (מ"א י כז), ולא היו נגנבות, אמר ר' יוסי בר חנינא היו כאבני עשר אמות, וכאבני שמונה אמות, תני ר' שמעון בן יוחי אפילו משקלות שהיו בימי שלמה של זהב היו. ולשמחה מה זו עושה, א"ל הקב"ה מה העטרה הזו בידך, רד מכסאך, מיד ירד מלאך בדמות שלמה וישב על כסאו, והיה שלמה מחזר בבתי כנסיות ובבתי מדרשות, ואומר אני קהלת הייתי מלך [על ישראל בירושלים] (קהלת א יב), והם אומרים לו שלמה המלך יושב על כסאו, ואתה הולך ומשתטה, והיו מכין אותו בקנה, ונותנין לפניו קערה של גריסין, באותה שעה אמר שלמה וזה היה חלקי מכל עמלי (קהלת ב י).