It has been suggested that ‘Psalm 137 has the distinction of having one of the most beloved opening lines and the most horrifying closing line of any psalm.’ (Clifford)

137:1 By the rivers of Babylon
we sit down and weep
when we remember Zion.
137:2 On the poplars in her midst
we hang our harps,
137:3 for there our captors ask us to compose songs;
those who mock us demand that we be happy, saying:
“Sing for us a song about Zion!”
137:4 How can we sing a song to the LORD
in a foreign land?
137:5 If I forget you, O Jerusalem,
may my right hand be crippled!
137:6 May my tongue stick to the roof of my mouth,
if I do not remember you,
and do not give Jerusalem priority
over whatever gives me the most joy.
137:7 Remember, O LORD, what the Edomites did
on the day Jerusalem fell.
They said, “Tear it down, tear it down,
right to its very foundation!”
137:8 O daughter Babylon, soon to be devastated!
How blessed will be the one who repays you
for what you dished out to us!
137:9 How blessed will be the one who grabs your babies
and smashes them on a rock!

v7 ‘God both by Ezekiel and Jeremiah had predicted that he would punish the Edomites, (Eze 25:13; Jer 49:7; and Lam 4:21) and Obadiah distinctly gives the reason, answerable to what is here stated — that they had conspired with the Babylonians. (Oba 1:11.)…The Psalmist prays, under the inspiration of the Spirit, that God would practically demonstrate the truth of this prediction. And when he says, Remember, O Jehovah! he would remind God’s people of the promise to strengthen their belief in his avenging justice, and make them wait for the event with patience and submission. To pray for vengeance would have been unwarrantable, had not God promised it, and had the party against whom it was sought not been reprobate and incurable; for as to others, even our greatest enemies, we should wish their amendment and reformation.’ (Calvin)

v8 Daughter of Babylon, doomed to destruction – ‘Incredible as it might appear that any calamity should overtake so mighty an empire as Babylon then was, and impregnable as it was generally considered to be, he sees in the glass of the Word its destruction and overthrow.’ (Calvin)

How blessed will be the one who repays you
for what you dished out to us!
137:9 How blessed will be the one who grabs your babies
and smashes them on a rock!

'Happy is he who dashes your infants against the rocks'

137:8 O daughter Babylon, soon to be devastated!
How blessed will be the one who repays you
for what you dished out to us!
137:9 How blessed will be the one who grabs your babies
and smashes them on a rock!

This apparent celebration of violence is, for many, impossible to countenance.

Ehrman (Jesus, Interrupted) asks:

‘Knocking the brains out of the Babylonian babies in retaliation for what their father-soldiers did? Is this in the Bible?’

Derek Flood (Disarming Scripture, p20f) is dismissive of any attempts to justify the text.  He cites Grogan as saying,

‘The modern reader … would be much less troubled by the simple statement that it would be good when the evil Babylonian empire came to its divinely predicted end.’

Flood’s response is:

‘In other words, atrocities and violence are less disturbing when its victims are thought of in impersonal and abstract terms. Try not to imagine their faces, and it isn’t as upsetting. This is the advice we are given by a commentary that prides itself for its focus on the Bible’s contemporary relevance and theological reflection.’

I think that Flood should have made a better effort to understand both the text and Grogan’s comment on it before finding fault with both.

Grogan’s comment in full is:-

Crenshaw thinks these imprecatory prayers cannot be justified theologically: “the use of Psalms for daily devotion and as a model of prayer … runs the risk of infecting religious people with harmful attitudes. Do the prayers for vengeance against personal enemies sacralize violence?” Surely our answer to Crenshaw must be no. There is no suggestion of the psalmist himself taking a vengeful initiative. These passages are prayers, not programs for human action. The psalmist leaves the matter in the hands of God, calling on him to uphold the right. In this respect, they are remarkably similar to an NT passage, Rev 6:9–10: “I saw under the altar the souls of those who had been slain because of the word of God and the testimony they had maintained. They called out in a loud voice, ‘How long, Sovereign Lord, holy and true, until you judge the inhabitants of the earth and avenge our blood?’ ”
Many readers will find Ps 137:8–9 particularly difficult, for here the psalmist invokes a blessing on those who violently take the lives of children in Babylon. Two points may be made. The first is that what the psalmist contemplates is what the prophet Isaiah had predicted would happen (Isa 13:16). The second is that the OT as a whole often tends to use concrete language in contexts where modern writers are more likely to use abstract terms. This is usually helpful to us in giving vividness to the expression, but in this case the vividness is just too intense for the imagination of the modern reader, who would be much less troubled by a simple statement that it would be good when the evil Babylonian regime came to its divinely predicted end, for this is what these verses mean.

This is considerably more nuanced that Flood would have us believe, as are the comments of a range of other interpreters:-

DeClaisse-Walford argues that

‘Psalm 137, along with the other imprecatory psalms in the Psalter, reminds us of the basic human desire for revenge when we or those we love have been wronged. God does not ask us to suppress those emotions, but rather to speak about them in plain and heartfelt terms. In the speaking out, we give voice to the pain, the feelings of helplessness, and the burning anger. In speaking out to God, we give the pain, the helplessness, and the burning anger to God. And we trust that God’s justice will be done.’

Witherington (responding to the throwaway comment of Ehrman, noted above) –

‘In the first place this is a song, and so should not be treated like a theological or ethical treatise. In the second place, what this song is a revelation of is what is on the heart of the psalmist. In the psalms, human beings speak to, pray to, implore their God in various ways. It is a very truthful and accurate reflection of various things on and in the human heart, including the desire for vengeance. What the psalms are generally not is a revelation of what is in God’s heart or character.’

Calvin –

‘It may seem to savor of cruelty, that he should wish the tender and innocent infants to be dashed and mangled upon the stones, but he does not speak under the impulse of personal feeling, and only employs words which God had himself authorized, so that this is but the declaration of a just judgment, as when our Lord says, “With what measure ye mete, it shall be measured to you again.” (Mt 7:2.)’

Kidner (TOTC) suggests that in the cool light of day the Psalmist might have reasoned:

‘What do the perpetrators of such acts deserve? the  dispassionate answer would presumably be ‘the degree of suffering they imposed on others’, leaving aside the further question of what should in fact be done to them, and by whom. To that further question the New Testament replies that ultimately God ‘will render to every man according to his works’, but also makes it clear that wrath is only for the ‘hard and impenitent heart’ (Rom. 2:5f.).’

As it is, the Psalmist’s thoughts and feelings are expressed with white-hot intensity.  Kidner proposes a threefold response for us reading this today:

First, to distil the essence of it, as God himself did with the cries of Job and Jeremiah. Secondly, to receive the impact of it. This raw wound, thrust before us, forbids us to give smooth answers to the fact of cruelty. To cut this witness out of the Old Testament would be to impair its value as revelation, both of what is in man and of what the cross was required to achieve for our salvation. Thirdly, our response should be to recognize that our calling, since the cross, is to pray down reconciliation, not judgment.’

Broyles (UBCS) notes that

‘such passionate loyalty is something with which few of us can identify, though not necessarily because we are more noble. We too should passionately guard the heritage God has given us, and we must ensure that our passionate rage be committed to God in prayer, as this psalm endorses, and not taken into our own hands. Otherwise, we abuse the text by ignoring its context, namely that Psalm 137 is in the mouth of powerless victims, not powerful executioners. As we have seen elsewhere in the Psalms, especially the laments, these prayers allow God’s people to vent their feelings, even when they may not have complete theological endorsement or legitimacy (see the Introduction). Although, for example, the lament, “My God, my God, why have you forsaken me?” (Psa 22:1), is not an accurate reflection of God’s actual relationship to the speaker (note how the psalm later withdraws this claim in v. 24), such impassioned expressions of feelings are not expunged from the canonized psalms.’

Mays, too, has some helpful things to say:

‘There is no evading the passionate pain and anger that animates these prayers. They call for the accounts in the books of history to be balanced. But they are not to be reduced to a personal desire for savage revenge…Whatever justifiable reservations may lead us to omit their prayers from our lections and prayers must not obscure the question their passion and understanding places against ours.’

Ellsworth notes that

‘in the process of taking Jerusalem, the Babylonians committed unspeakable atrocities against its citizens. Babies were brutally killed and women were ravished. In taking this position, the writer was merely acknowledging the moral principle that God himself has revealed, namely, what we sow, we reap (Job 4:8; Prov. 22:8; Hos. 10:13; Gal. 6:7). More particularly, he was delighting in the prospect of that which God himself had promised to do, namely, bring severe judgement on Babylon (Isa. 13:1–22, esp. v. 16).’

According to Zengler, this psalm

‘is an attempt, in the face of the most profound humiliation and helplessness, to suppress the primitive human lust for violence in one’s own heart, by surrendering everything to God—a God whose word of judgment is presumed to be so universally just that even those who pray the psalm submit themselves to it.’

According to Hard Sayings of the Bible,

‘The words “dashes [your infants] against the rocks” are usually regarded as being so contrary to the teachings of the New Testament that here is little need to discuss the matter any further. Curiously enough, these very same words are repeated in the New Testament by no one less than our Lord (Lk 19:44). In fact, the verb in its Greek form is found only in Psalm 137:9 (in the Septuagint, the Greek translation of the Hebrew text) and in the lament of our Lord over Jerusalem in Luke 19:44. This is the clearest proof possible that our Lord was intentionally referring to this psalm.’
‘What, then, does “Happy is he who repays you for what you have done to us—he who seizes your infants and dashes them against the rocks” mean? It means that God will destroy Babylon and her progeny for her proud assault against God and his kingdom. But those who trust in God will be blessed and happy. For those who groaned under the terrifying hand of their captors in Babylon there was the prospect of a sweet, divine victory that they would share in as sons and daughters of the living God. As such, this is a prayer Christians may also pray, so long as it is realized that what is at stake is not our own reputation or our personal enemies, but the cause of our Lord’s great name and kingdom.’

What you dished out to us! – The imprecation of v8f is not random, or frivolous.  It is the white-hot response to acts of terrible cruelty.  In a calmer moment, the psalmist would have acknowledge that the Lord says, ‘vengeance is mine; I will repay.’  The yet more radical ethic of Jesus teaches us to pray for our enemies, and to seek reconciliation, rather than vindication.

v9 Neighbouring nations were in the habit of dealing thus with children when engaging in their many wars, 2 King 8:12; Hos 10:14; 13:16; Nah 3:10.  God through Isaiah, Isa 13:16, and already predicted Babylon’s destruction in similar terms, and so the writer here is fully mindful of God’s prerogative in judgement, aligning himself with God’s already-revealed will.