“I will praise you with an upright heart,
when I learn your righteous ordinances” (Psa. 119:7 NRSV).
In verse 6, the psalmist spoke of shame-avoidance, in verse 7 the theme is being righteous. Based on the righteousness focus, it sounds like the psalmist has a “holier-than-thou” attitude, but there’s more to it than that.
The psalmist has a plan. First learn YHWH’s righteous ordinances, then praise YHWH with a heart that has apparently been purified by knowledge of said ordinances. (The words here for upright (yosher) and righteous (mishpat), while in English sound similar, aren’t from the same Hebrew root.) The psalmist expects God to help out as an instructor in teaching his laws to this eager pupil, assuming that God would be motivated to teach in order to receive praise.
Let’s face it, most Christians don’t have a favorable impression of legal texts like Leviticus and Deuteronomy, but God’s laws should lead to praise. The psalmist understood that. They help make us righteous, which should lead to worship.
In the words of the esteemed surfer-dude sea turtle Crush from Finding Nemo: “Righteous!”