Postgres: Improve handling of empty strings

This fixes an issue where empty strings that are the last values in the copy statement get truncated, which results in errors and data loss when re-importing a dump into a postgres db.

This is caused by a gsub that replaces all newline characters in a line with an empty string, which causes a consecutive split based on tab characters to return an array with less items than in the original row.