Here’s a little gem that Jason Hood sent my way:
David desires to be delivered in the righteousness of God, because God displays his righteousness in performing his promise to his servants. It is too much refinement of reasoning to assert that David here betakes himself to the righteousness which God freely bestows on his people, because his own righteousness by works was of no avail. Still more out of place is the opinion of those who think that God preserves the saints according to his righteousness; that is to say, because having acted so meritoriously, justice requires that they should obtain their reward. It is easy to see from the frequent use of the term in the Psalms, that God’s righteousness means his faithfulness, in the exercise of which he defends all his people who commit themselves to his guardianship and protection. David, therefore, confirms his hope from the consideration of the nature of God, who cannot deny himself, and who always continues like himself.
John Calvin on Psalm 31:1