In this song David the king is telling his people about a very, very special status they have with Jehovah. While he doesn't mention that status by name, yet he makes it extremely plain by what he sings.
He begins with the general principle: fools say no to God in their hearts - they simply deny His existence. But the result of such atheism is corruption: "They are corrupt. They have done abominable works." That's the way it is with those who don't think anyone cares.
David probably sang all the words up to this point in a minor key, possibly even with dissonance. But then the minor key dissonance reaches a climax as he expresses the fact that the whole world is involved in that awful atheism and corruption. He sings, "They have ALL turned aside, they have together become corrupt; there is NONE who does good - no, not one!" We can almost hear the crashing and clashing of the cymbals!
But then, amid such resounding declarations of the guilt of absolutely every member of the human race, David the king sings a very surprising line. He asks the question, "Have all the workers of iniquity no knowledge, who eat up my people as they eat bread, and do not call on the Lord?" It's as though David was claiming that his kingdom wasn't involved in the general atheism and corruption, but that it was the rest of the world that was like that, and Israel was being attacked by those wicked "other people."
We have to come to an obvious and necessary conclusion: Israel was involved all right, but by pure grace they were the covenant people of God nevertheless! They were rescued sinners, chosen and redeemed people of God! The result is that the God-hating world hates them and "eats them up as they eat bread!"
But they do it at a price. David sings, "There they are in great fear - for God is with the generation of the righteous (Israel)." It needs very much to be understood that the rebels of this world, the fallen human race - knows its own guilt, knows the just wrath of God. It may not be expressed in so many words, but deep down they know they're doomed. David turns to them and sings, "You shame the counsel of the poor, but the Lord is his refuge." In other words, "You'll have to pay for this - God sees!"
Finally, realizing what a sinful world this is, realizing all the pain and shame that sin has caused and is causing - David, looking forward to the fulfillment of God's Messianic promise, sings, "Oh that the salvation of Israel (Christ) would come out of Zion! When the Lord brings back the captivity of His people, let Jacob rejoice and Israel be glad!"
The great difference in our day is that Christ has come! It's the beginning of the end for this sinful world. But what is it to YOU? Do you long for His coming again and for the judgement of man's rebellion? Do you long for the final salvation of God's saints? If so, then let's join David in this song!