Re: Small fix on COPY ON_ERROR document

From: Yugo NAGATA <nagata(at)sraoss(dot)co(dot)jp>
To: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Small fix on COPY ON_ERROR document
Date: 2024-01-26 06:48:10
Message-ID: 20240126154810.3b93ae4799a1555418381cbe@sraoss.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, 26 Jan 2024 15:26:55 +0900
Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com> wrote:

> On Fri, Jan 26, 2024 at 2:40 PM Yugo NAGATA <nagata(at)sraoss(dot)co(dot)jp> wrote:
> >
> > On Fri, 26 Jan 2024 13:59:09 +0900
> > Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com> wrote:
> >
> > > On Fri, Jan 26, 2024 at 11:28 AM Yugo NAGATA <nagata(at)sraoss(dot)co(dot)jp> wrote:
> > > >
> > > > Hi,
> > > >
> > > > I found that the documentation of COPY ON_ERROR said
> > > > COPY stops operation at the first error when
> > > > "ON_ERROR is not specified.", but it also stop when
> > > > ON_ERROR is specified to the default value, "stop".
> > > >
> > > > I attached a very small patch to fix this just for
> > > > making the description more accurate.
> > >
> > > Thank you for the patch!
> > >
> > > +1 to fix it.
> > >
> > > - <literal>ON_ERROR</literal> is not specified. This
> > > - should not lead to problems in the event of a <command>COPY
> > > + <literal>ON_ERROR</literal> is not specified or <literal>stop</literal>.
> > > + This should not lead to problems in the event of a <command>COPY
> > >
> > > How about the followings for consistency with the description of the
> > > ON_ERROR option?
> > >
> > > COPY stops operation at the first error if the stop value is specified
> > > to the ON_ERROR option. This should not lead to ...
> >
> > Thank you for you review. However, after posting the previous patch,
> > I noticed that I overlooked ON_ERROR works only for errors due to data
> > type incompatibility (that is mentioned as "malformed data" in the
> > ON_ERROR description, though).
>
> Right.
>
> >
> > So, how about rewriting this like:
> >
> > COPY stops operation at the first error unless the error is due to data
> > type incompatibility and a value other than stop is specified to the
> > ON_ERROR option.
>
> Hmm, this sentence seems not very readable to me, especially the "COPY
> stops ... unless ... a value other than stop is specified ..." part. I
> think we can simplify it:

I can agree with your opinion on the readability, but...

> COPY stops operation at the first data type incompatibility error if
> the stop value is specified to the ON_ERROR option.

This statement doesn't explain COPY also stops when an error other than
data type incompatibility (e.g. constrain violations) occurs.

Maybe, we can separate the sentese to two, for example:

COPY stops operation at the first error. (The exception is if the error
is due to data type incompatibility and a value other than stop is specified
to the ON_ERROR option.)

Regards,
Yugo Nagata

> Regards,
>
> --
> Masahiko Sawada
> Amazon Web Services: https://aws.amazon.com

--
Yugo NAGATA <nagata(at)sraoss(dot)co(dot)jp>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Rowley 2024-01-26 06:54:16 Delay Memoize hashtable build until executor run
Previous Message Andrey M. Borodin 2024-01-26 06:46:43 Re: Transaction timeout