There was a season when Solomon was not Solomon. The demon king Ashmedai had stolen his signet ring — the one engraved with the Ineffable Name — and taken his place on the throne of Israel. The real Solomon wandered the streets as a beggar, and the palace kept going without him.
The rabbis in the academy began to notice small wrongnesses. The king was behaving strangely. Benaiah, his general, admitted privately that the king no longer summoned him. But the king still visited the harem — and that was the clue. The sages sent word: Look at his feet. A demon's feet are like a rooster's.
The report came back that the king never removed his stockings. That settled it. The rabbis found the true Solomon, escorted him back to the palace, and pressed the ring and chain into his hand.
Solomon walked into the throne room. Ashmedai was still sitting there, comfortable. But the moment he saw the king approaching with the Name, he shrieked, raised his wings, and vanished into the invisibility he came from.
Even after the victory, Solomon slept badly. Song of Songs (3:7-8) hints at the trauma: Behold, the bed of Solomon — threescore valiant men around it, every man his sword upon his thigh, because of fear in the night. Gittin 68 preserves the tale. Kingship, the rabbis whisper, is not safe even when you win it back.