Conflict handling for COPY FROM

From: Surafel Temesgen <surafel3000(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Conflict handling for COPY FROM
Date: 2018-08-04 13:09:51
Message-ID: CALAY4q8PcAcTUVgjvKkNxenoAcydiwUuYhwNwad4kcZQ9Ewdbw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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(at)gmail(dot)com

Comment?

Regards

Surafel

Attachment Content-Type Size
conflict-handling-onCopy-from-v1.patch text/x-patch 20.3 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kohei KaiGai 2018-08-04 13:29:28 Re: [report] memory leaks in COPY FROM on partitioned table
Previous Message Daniel Verite 2018-08-04 13:00:55 Re: Stored procedures and out parameters