Midrash Tehillim quotes Rabbi Pinchas, who notes that in some psalms David calls himself by name, as in "A prayer of David" (e.g. Psalm 17 and 86), but here he calls himself "the afflicted", as in "A prayer of the afflicted".
Rabbi Pinchas explains that when David foresaw the righteous men who would descend from him—Asa, Jehoshaphat, Hezekiah, Isaiah—he called himself David.
But when he perceived the wicked men who would be his descendants—Ahaz, Manasseh, Amon—he called himself "the afflicted".
Midrash Tehillim quotes Rabbi Pinchas, who notes that in some psalms David calls himself by name, as in "A prayer of David" (e.g. Psalm 17 and 86), but here he calls himself "the afflicted", as in "A prayer of the afflicted". Rabbi Pinchas explains that when David foresaw the righteous men who would descend from him—Asa, Jehoshaphat, Hezekiah, Isaiah—he called himself David. But when he perceived the wicked men who would be his descendants—Ahaz, Manasseh, Amon—he called himself "the afflicted".
Psalm 102