4 “The Lord from Heaven has looked forth upon the sons of men, that He might see if there is one understanding and seeking after God”. What is this? “Corrupted they are,” all these that say, “There is no God”? And what? Did it escape God, that they had become such? Or indeed to us would their inward thought be opened, except by Him it were told? If then He understood, if then He knew, what is this which has been said, “that He might see”? For the words are of one inquiring, of one not knowing.
“God from Heaven has looked forth,” etc. And as though He had found what He sought by looking upon, and by looking down from Heaven, He gives sentence: “All men have gone aside, together useless they have become: there is not one that does good, not so much as one”. Two questions arise somewhat difficult: for if God looks out from Heaven, in order that He may see if there is one understanding or seeking after God; there steals upon an unwise man the thought, that God knows not all things.
This is one question: what is the other? If there is not one that does good, is not so much as one; who is he that travails amid bad men? The former question then is solved as follows: ofttimes the Scripture speaks in such manner, that what by the gift of God a creature does, God is said to do....For hence has been said the following also, “For the Spirit searches all things, even the depth of God;” not because He that knows all things searches, but because to you has been given the Spirit, which makes you also to search: and that which by His own gift you do, He is said to do; because without Him you would not do it: therefore God is said to do, when you do.
And because this by the gift of God you doest, God from heaven is “looking forth upon the sons of men.” The former question then, according to our measure, thus has been solved.
Source: The Enarrations, or Expositions, on the Psalms (New Advent)