Related for Sanhedrin 208:12
(תהלים יד, ד) אוכלי עמי אכלו לחם ה' לא קראו אמר רבא אמר ר' יוחנן כל האוכל מלחמן של ישראל טועם טעם לחם ושאינו אוכל מלחמן של ישראל אינו טועם טעם לחם ה' לא קראו רב אמר אלו הדיינין ושמואל אמר אלו מלמדי תינוקות
They call not upon the Lord. Rab said: This refers to the judges;<span class="x" onmousemove="('comment',' Who do not mete out fair justice. ');"><sup>31</sup></span> Samuel said: To teachers of children.<span class="x" onmousemove="('comment',' Who do not carry out their task honestly. ');"><sup>32</sup></span> Now, who enumerated them?<span class="x" onmousemove="('comment',' Who originally enumerated these kings and commoners as having no portion in the coming world, seeing that ordinary persons cannot know such things? ');"><sup>33</sup></span>
Shir HaShirim Rabbah
Yitzḥak son of Rav Yehuda bar Yeḥezkel said: It is written: “I have built [bano baniti] an abode for You” (I Kings 8:13); I have built for you a built building.6The verse is quoting Solomon as saying that he put up a building, the Temple, that was actually built by itself. Rabbi Berekhya said: “The House that they were building,” is not written here, but rather: “The House, in its construction” (I Kings 6:7), [indicating that] it was built on its own, as it is stated: “It was built of whole stones that were transported” (I Kings 6:7). “Built” is not written here, but rather, “it was built [nivna].”7The midrash understands the term nivna as a reflexive term, indicating that it built itself. This teaches that the stone would lift itself and be placed on the row of stones. Rav said: Do not be astonished by this. What is written below? “One stone was brought and placed at the entrance to the den” (Daniel 6:18). Were there stones in Babylon?8Babylon has only lowlands and soft earth, and no mountains. Rather, it flew from the Land of Israel at that moment and came and settled at the entrance to the pit. Rav Huna said, in the name of Rav Yosef: An angel descended in the image of a stone lion and settled at the entrance of the pit. That is what in written: “My God sent His angel and closed the lions’ mouths” (Daniel 6:23). Do not be astonished; if in honor of that righteous one [Daniel], it is written: “One stone was brought,” in honor of the Holy One blessed be He9For the building of the Temple. all the more so.
“He will stand before kings”—he will stand before kings of the Torah. “He will not stand before dark ones,” this is the group of the wicked. Rabbi Yehoshua ben Levi said: When [the Sages] voted, and concluded that three kings and four commoners do not have a portion in the World to Come, they sought to add Solomon to them.10This was due to what is described in I Kings 11:1–10. A Divine Voice emerged and said: “Do not touch My anointed ones” (Psalms 105:15). Rabbi Yehuda bar Simon said: Moreover, he is listed as the head of a [royal] genealogical lineage, as it is stated: “Reḥavam the son of Solomon [reigned in Jerusalem]” (I Kings 14:21). Rabbi Yudan bar Simon said: Moreover, the Divine Spirit rested upon him and he composed these three books: Proverbs, Song of Songs, and Ecclesiastes.