For example, carriage returns should also be escaped properly but not, hence causing troubles like HazyResearch/deepdive#523.
I think this part of the code needs more careful work to conform to Postgres' TSV format or some other stricter standard:
|
str.replace("\n", " ").replace("\t", " ") |