Errors When Reading Multiple Files
The COPY command is atomic and transactional. In other words, even when the COPY command reads data from multiple files, the entire process is treated as a single transaction. If COPY encounters an error reading a file, it automatically retries until the process times out (see statement_timeout) or if data cannot be download from Amazon S3 for a prolonged period of time (between 15 and 30 minutes), ensuring that each file is loaded only once. If the COPY command fails, the entire transaction is aborted and all changes are rolled back. For more information about handling load errors, see Troubleshooting Data Loads.
After a COPY command is successfully initiated, it does not fail if the session terminates, for example when the client disconnects. However, if the COPY command is within a BEGIN … END transaction block that does not complete because the session terminates, the entire transaction, including the COPY, is rolled back. For more information about transactions, see BEGIN.