Taking isolated verses out of all context has been troublesome in and out of the church down through the ages.

Psalm 137 is said to have been written by the exiles in response to the Babylonians asking the Jews to sing their Jewish songs. At the time, the Jewish national identity was closely associated with Jerusalem and the temple built there. The Jewish people in exile felt their disposesion quite keenly. The second half of the psalm, in particular, is highly poetic about how they feel about this. Thus verse 9.

I can research more about this psalm if you like.

Wade.