I have csv file that has contents like this:
10,53073,0,0,\'Y\',\'2008-05-30 21:46:55\',0,\'2008-05-30 21:48:04\',0,53071,2
I want to load the
Double single quotes (if standard_conforming_strings
is on, see the docs)
COPY my_table FROM 'c:\downloads\file.csv' DELIMITERS ',' CSV QUOTE '''';
or use the non-standard PostgreSQL-specific escape string:
COPY my_table FROM 'c:\downloads\file.csv' DELIMITERS ',' CSV QUOTE E'\'';
Some other people who are experiencing this error may want to check the file to see if it contains a header on the first line. While it wasn't the problem in your case, it is worth noting the way to work around it:
COPY my_table FROM 'c:\downloads\file.csv' WITH DELIMITER ',' CSV HEADER;
Never mind, I got the answer:
COPY my_table FROM 'c:\downloads\file.csv' DELIMITERS ',' CSV QUOTE '''';