Here is how John Calvin reconciles David’s delight in God’s law in Psalm 19 and Paul’s approbation of the law in certain parts of his writings.
But in the first place, we must remember what I have shown you at the commencement, that David does not speak simply of the precepts of the Moral Law, but comprehends the whole covenant by which God had adopted the descendants of Abraham to be his peculiar people; and therefore to the Moral Law-the rule of living well- he joins the free promises of salvation, or rather Christ himself, in whom and upon whom this adoption is founded. But Paul who had to deal with persons who perverted and abused the law, and separated it from the grace and Spirit of Christ, refers to the ministry of Moses viewed merely by itself, and according to the letter.
It is certain, that if the Spirit of Christ does not quicken the law, the law is not only unprofitable, but also deadly to its disciples. Without Christ there is in the law nothing but inexorable rigor, which adjudges all mankind to the wrath and curse of God. And farther, without Christ, there remains within us a rebelliousness of the flesh, which kindles in our hearts a hatred of God and his law, and from this proceed the distressing bondage and awful terror of which the Apostle speaks.
These different ways in which the law may be viewed, easily show us the manner of reconciling these passages of Paul and David, which seem at first view to be at variance. The design of Paul it so to show what the law can do for us, taken by itself; that is to say, what it can do for us when, without the promise of grace, it strictly and rigorously exacts from us the duty which we owe to God; but David, in praising it, as he here does, speaks of the whole doctrine of the law, which includes the gospel, and, therefore under the law he comprehends Christ.