Verse 6 says, "Because of this let everyone who is godly/Pray to You at a time when You may be found;/Surely when great waters overflow,/They will not reach him." This shows that although David confessed his sin and realized the iniquity of his sin, he considered himself as a godly one. Is he sinful or is he godly? This is a psalm on confession, but in this confession there is self-justification. He confessed his sin, but he also indicated that he did not have any deceit in his spirit, that he was a godly one, and that he was seeking God at the time when God might be found.
In verse 7 David said, "You are my hiding place;/You preserve me from trouble;/You surround me with the ringing shouts of deliverance. Selah."
Then God came in to instruct and teach David. Verses 8-10 say, "I will instruct you and teach you concerning the way you should go;/I will counsel you; My eye is upon you./Do not be like a horse or like a mule, without understanding;/Whose trappings consist of bit and bridle to constrain them, /Else they do not come near you./Many are the sorrows that the wicked have;/But he who trusts in Jehovah is encompassed by lovingkindness." David said that the wicked have many sorrows, but that the one who trusts in Jehovah is encompassed by lovingkindness. Was David a person with many sorrows, or was he the one trusting in Jehovah? It is difficult to say which category David was in. This shows that his speaking here is according to the natural concept.
Verse 11 says, "Rejoice in Jehovah and exult, O righteous ones;/And give a ringing shout, all you who are upright in heart." Who are the righteous ones and who is upright in heart? We do not have the boldness to say that we are such ones. Thus, this is a psalm with a good beginning but a poor ending. The beginning is confessing, and the ending is self-justification. Basically speaking, Psalms 31 and 32 show us a person trying to keep the law without Christ.