7 “For You, Lord, art good and gracious”....Even prayers are often hindered by vain thoughts, so that the heart scarcely remains fixed on God: and it would hold itself so as to be fixed, and somehow flees from itself, and finds no frames in which it can enclose itself, no bars by which it may keep in its flights and wandering movements, and stand still to be made glad by its God. Scarcely does one such prayer occur among many. Each one might say that this happened to him, but that it happened not to others, if we did not find in the holy Scripture David praying in a certain place, and saying, “Since I have found my heart, O Lord, so that I might pray unto You.” He said that he had found his heart, as if it were wont to flee from him, and he to follow it like a fugitive, and not be able to catch it, and to cry to God, “For my heart has deserted me.” Therefore, my brethren, thinking over what he says here, I think I see what he means by “gracious.”
I seem to feel that for this reason he calls God gracious, because He bears with those failings of ours, and yet expects prayer from us, in order to make us perfect: and when we have given it to Him, He receives it gratefully, and listens to it, and remembers not those many prayers which we pour out unthinkingly, and accepts the one which we can scarcely find. For what man is there, my brethren, who, on being addressed by his friend, when he wishes to answer his address, sees his friend turn away from him and speak to another, who is there who would bear this?
Or if you appeal to a judge, and set him up to hear you, and all at once, while you are speaking to him, pass from him, and begin to converse with your friend, who would endure this? Yet God endures the hearts of so many persons who pray and think of different things....What then? Must we despair of mankind, and say that every man is already condemned into whose prayers any wandering thoughts have crept and interrupted them? If we say this, my brethren, I know not what hope remains.
Therefore because there is some hope before God, because His mercy is great, let us say unto Him, “For unto You, O Lord, have I lifted up my soul.” And how have I lifted it up? As I could, as You gave me strength, as I could catch it when it fled away....From infirmity I sink: heal me, and I shall stand: strengthen me, and I shall be strong. But until You do this, You bear with me: “For You, Lord, are good and gracious, and of great mercy.” That is, not only “of mercy,” but “of great mercy:” for as our iniquity abounds, so also abounds Your mercy.
“Unto all that call upon You.” What is it then which Scripture says in many places: “They shall call, and I will not hear them”? Yet surely You are merciful to all that call upon You; but that some call, yet call not upon Him, of whom it is said, “They have not called upon God.” They call, but not on God. You call upon whatever you love: you call upon whatever you call unto yourself, whatever you wish to come unto you. Therefore if you call upon God for this reason, in order that money may come unto you, that an inheritance may come unto you, that worldly rank may come unto you, you call upon those things which you desire may come unto you: but you make God the helper of your desires, not the listener to your needs.
God is good, if He gives what you wish? What if you wish ill, will He not then be more merciful by not giving? Then, if He gives not, then is God nothing to you; and you say, How much I have prayed, how often I have prayed, and have not been heard! Why, what did you ask? Perhaps that your enemy might die. What if he at the same time were praying for your death? He who created you, created him also: you are a man, he too is a man; but God is the Judge: He hears both, and He grants their prayer to neither.
You are sad, because you were not heard when praying against him; be glad, because his prayer was not heard against you. But you say, I did not ask for this; I asked not for the death of my enemy, but for the life of my child; what ill did I ask? You asked no ill, as you thought. What if “he was taken away, lest wickedness should alter his understanding.” But he was a sinner, you say, and therefore I wished him to live, that he might be corrected. You wished him to live, that he might become better; what if God knew, that if he lived he would become worse?...If, therefore, you call on God as God, be confident you shall be heard: you have part in that verse: “And of great mercy unto all that call upon You.”...
Source: The Enarrations, or Expositions, on the Psalms (New Advent)