How to resume on error during csv import in Postgresql
I'm using pgadminIII to run the queries. How to I continue the import process开发者_运维知识库 and output the errors to a file with a copy command?
copy my_db FROM E'D:\\my_textfile.txt' WITH CSV HEADER DELIMITER ';';
You can't, as Sam stated, but you can use external tool - pgloader which has this capability.
You can't. The COPY command is a single transaction so either all the data will get imported or none of it will. If you want to import data and not exit on errors, then you will need to use individual INSERT statements. That's the tradeoff with COPY. It's more efficient because it is a single transaction, but it requires that your data be error-free to succeed.
精彩评论