Re: Conflict handling for COPY FROM

From: "Nasby, Jim" <nasbyj(at)amazon(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Surafel Temesgen <surafel3000(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Conflict handling for COPY FROM
Date: 2018-12-04 19:15:24
Message-ID: C85CD39D-65D8-4CBF-955C-AEEF731E648B@amazon.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Aug 20, 2018, at 5:14 AM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
>
> On Sat, Aug 4, 2018 at 9:10 AM Surafel Temesgen <surafel3000(at)gmail(dot)com> wrote:
> 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.
>
> Why should this be a GUC rather than a COPY option?
>
> In fact, try doing all of this by adding more options to COPY rather than new syntax.
>
> COPY ... WITH (ignore_conflicts 1000, ignore_logfile '...')
>
> It kind of stinks to use a log file written by the server as the dup-reporting channel though. That would have to be superuser-only.

Perhaps a better option would be to allow the user to specify a name for a cursor, and have COPY do the moral equivalent of DECLARE name? Calling a function for each bad row would be another option.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2018-12-04 19:42:16 Re: reducing isolation tests runtime
Previous Message Alvaro Herrera 2018-12-04 18:48:56 Re: psql display of foreign keys