From: | Surafel Temesgen <surafel3000(at)gmail(dot)com> |
---|---|
To: | Tatsuo Ishii <ishii(at)sraoss(dot)co(dot)jp> |
Cc: | asaba(dot)takanori(at)fujitsu(dot)com, Alexey Kondratov <a(dot)kondratov(at)postgrespro(dot)ru>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, Andrew Dunstan <andrew(dot)dunstan(at)2ndquadrant(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Anthony Nowocien <anowocien(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Conflict handling for COPY FROM |
Date: | 2020-02-17 06:26:27 |
Message-ID: | CALAY4q_ue=XqBgnJjq=ntxv=LtPX-8Dnng7=EqLswwAnRXHb_w@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi,
> > ERROR_LIMIT '<replaceable
> class="parameter">limit_number</replaceable>'
> >
> > I think this should be:
> >
> > ERROR_LIMIT <replaceable class="parameter">limit_number</replaceable>
> >
> > (no single quote)
>
>
Thank you .Fixed
> More comments:
>
> - I think the document should stat that if limit_number = 0, all
> errors are immediately raised (behaves same as current befavior without
> the patch).
>
>
if we want all error to be raised error limit_number not need to be
specified.
but if it is specified like limit_number = 0 i think it is self-explanatory
> - "constraint violating rows will be returned back to the caller."
> This does explains the current implementation. I am not sure if it's
> intended or not though:
>
> cat /tmp/a
> 1 1
> 2 2
> 3 3
> 3 4
>
> psql test
> $ psql test
> psql (13devel)
> Type "help" for help.
>
> test=# select * from t1;
> i | j
> ---+---
> 1 | 1
> 2 | 2
> 3 | 3
> (3 rows)
>
> 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
regards
Surafel
Attachment | Content-Type | Size |
---|---|---|
conflict-handling-q-from-v13.patch | text/x-patch | 16.0 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Amit Langote | 2020-02-17 06:55:46 | tiny documentation fix |
Previous Message | Justin Pryzby | 2020-02-17 06:14:31 | Re: error context for vacuum to include block number |