Hi,In my migration script while I am using mysqldump to dump my MySQL database and PostgreSQL COPY command to copy the data files to PostgreSQL db, I am getting error cause of the newline in the fields
Mysqldump command:
Mysqldump –u username -p --no-create-info
--skip-triggers --skip-comments --fields-terminated-by =,
--lines-terminated-by=\n –TC:\tmp –r UTF8 dbname
PostgreSQL COPY command:
COPY dbname.tablename from
‘c:\tmp\tablename.txt’ WITH DELIMITER ‘,’ CSV
NULL ‘\N’ ;But I get the error-
literal carriage return found in data
hint: use \r to represent carriage return
context: COPY tablename line 52
I checked line 52, it has new line in one of the field data
I know I can postprocess the files that are created by mysqldump, but was wondering is there any way to handle it within the postgreSQL COPY command so it escapes the new line within field data?*