upright before him - In my relation to God I have been perfect as to all parts of His law. The perfection does not relate to degree.
mine iniquity - perhaps the thought of his heart to kill Saul (1Sa 24:6). That David does not allude to all his conduct, in all relations, is evident from Psa 51:1, etc.