Do you mean you stop dealing with errors concerned with constraints and triggers and we should review 0006-COPY_IGNORE_ERRORS?
Yes, this patch is simpler and I think it's worth adding it first.
Hmm, I applied v6 patch and when canceled COPY by sending SIGINT(ctrl + C), I faced the same situation as below. I tested it on CentOS 8.4.
Thank you for pointing out this error. it really needs to be taken into account. In the previous 0006 patch, there were 2 stages in one subtransaction - filling the buffer and 'replay mode' (reading from the buffer). Since only NextCopyFrom() is included in PG_TRY(), and the ERRCODE_QUERY_CANCELED error can occur anywhere, it is impossible to catch it and rollback the subtransaction.
I changed the 0006 patch and fixed this error and now only the 'replay buffer filling' is made in the subtransaction.
Patch 0005 (that processed constraints) needs to be finalized, because it requires subtransactions to rollback constraints, triggers. Therefore, it is not possible to fix it yet. There is a decision to put for(;;) loop in PG_TRY. It will solve the problem, but the code will be too complicated.