Re: Conflict handling for COPY FROM - Mailing list pgsql-hackers

From Tatsuo Ishii
Subject Re: Conflict handling for COPY FROM
Date
Msg-id 20200217.160000.1889738947788169392.t-ishii@sraoss.co.jp
Whole thread Raw
In response to Re: Conflict handling for COPY FROM  (Surafel Temesgen <surafel3000@gmail.com>)
Responses Re: Conflict handling for COPY FROM  (Surafel Temesgen <surafel3000@gmail.com>)
List pgsql-hackers
>> test=# copy t1 from '/tmp/a' with (error_limit 1);
>> ERROR:  duplicate key value violates unique constraint "t1_pkey"
>> DETAIL:  Key (i)=(2) already exists.
>> CONTEXT:  COPY t1, line 2: "2   2"
>>
>> So if the number of errors raised exceeds error_limit, no constaraint
>> violating rows (in this case i=1, j=1) are returned.
>>
> 
> error_limit is specified to dictate the number of error allowed in copy
> operation
> to precede. If it exceed the number the operation is stopped. there may
> be more conflict afterward and returning limited number of conflicting rows
> have no much use

Still I see your explanation differs from what the document patch says.

+      Currently, only unique or exclusion constraint violation
+      and rows formatting errors are ignored. Malformed
+      rows will rise warnings, while constraint violating rows
+      will be returned back to the caller.

I am afraid once this patch is part of next version of PostgreSQL, we
get many complains/inqueires from users. What about changing like this:

      Currently, only unique or exclusion constraint violation and
      rows formatting errors are ignored. Malformed rows will rise
      warnings, while constraint violating rows will be returned back
      to the caller unless any error is raised; i.e. if any error is
      raised due to error_limit exceeds, no rows will be returned back
      to the caller.

Best regards,
--
Tatsuo Ishii
SRA OSS, Inc. Japan
English: http://www.sraoss.co.jp/index_en.php
Japanese:http://www.sraoss.co.jp



pgsql-hackers by date:

Previous
From: Amit Langote
Date:
Subject: tiny documentation fix
Next
From: Takashi Menjo
Date:
Subject: RE: [PoC] Non-volatile WAL buffer