Does copy abort on a failed insertion?

Started by Reid Thompsonover 20 years ago2 messagesgeneral
Jump to latest
#1Reid Thompson
Reid.Thompson@ateb.com

If i have a pg_dump that is using COPY, and midway through the copy an
insert fails due to a unique constraint, will the COPY continue with the
rest of the records, or will it abort? If it aborts, will it perform a
rollback on the inserts up to that point?

thanks,
reid

#2Scott Marlowe
smarlowe@g2switchworks.com
In reply to: Reid Thompson (#1)
Re: Does copy abort on a failed insertion?

On Thu, 2005-09-29 at 14:28, Reid Thompson wrote:

If i have a pg_dump that is using COPY, and midway through the copy an
insert fails due to a unique constraint, will the COPY continue with the
rest of the records, or will it abort? If it aborts, will it perform a
rollback on the inserts up to that point?

Copies are all or nothing. Either the whole set gets inserted or none
of it.