David acted the part of a mad person long before he ever became king. He links Psalm 34 to this scenario.
1 Samuel 21:10 And David arose and fled that day for fear of Saul, and went to Achish the king of Gath.
11 And the servants of Achish said unto him, Is not this David the king of the land? did they not sing one to another of him in dances, saying, Saul hath slain his thousands, and David his ten thousands?
12 And David laid up these words in his heart, and was sore afraid of Achish the king of Gath.
13 And he changed his behaviour before them, and feigned himself mad in their hands, and scrabbled on the doors of the gate, and let his spittle fall down upon his beard.
14 Then said Achish unto his servants, Lo, ye see the man is mad: wherefore then have ye brought him to me?
15 Have I need of mad men, that ye have brought this fellow to play the mad man in my presence? shall this fellow come into my house?