It is possible that one had /r/n and the other just /n. I was doing the comparison using psql. The issue was not using LIKE and %. I resolved the problem by removing chr(13) from both sides. So my working query was had a where clause like this: WHERE REPLACE(message, chr(13), '') = REPLACE('<long string>', chr(13), '')