Hellow hackers,
A few commitfest ago there was same effort to add errors handling to COPY FROM[1] and i see there that we already have infrastructure for supporting handling of unique violation or exclusion constraint violation error and I think it is independently useful too. Attached is a patch to do that.
In order to prevent extreme condition the patch also add a new GUC variable called copy_max_error_limit that control the amount of error to swallow before start to error and new failed record file options for copy to write a failed record so the user can examine it.
With the new option COPY FROM can be specified like:
COPY table_name [ ( column_name [, ...] ) ]
FROM { 'filename' | PROGRAM 'command' | STDIN }[ON CONFLICT IGNORE failed_record_filename] [ [ WITH ] ( option [, ...] ) ]
[1].https://www.postgresql.org/message-id/flat/7179F2FD-49CE-4093-AE14-1B26C5DFB0DA@gmail.com
Comment?
Regards
Surafel