Re: Conflict handling for COPY FROM

From: Tatsuo Ishii <ishii(at)sraoss(dot)co(dot)jp>
To: surafel3000(at)gmail(dot)com
Cc: asaba(dot)takanori(at)fujitsu(dot)com, a(dot)kondratov(at)postgrespro(dot)ru, alvherre(at)2ndquadrant(dot)com, andres(at)anarazel(dot)de, andrew(dot)dunstan(at)2ndquadrant(dot)com, robertmhaas(at)gmail(dot)com, anowocien(at)gmail(dot)com, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Conflict handling for COPY FROM
Date: 2020-02-17 07:00:00
Message-ID: 20200217.160000.1889738947788169392.t-ishii@sraoss.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Takashi Menjo 2020-02-17 07:15:48 RE: [PoC] Non-volatile WAL buffer
Previous Message Amit Langote 2020-02-17 06:55:46 tiny documentation fix