Re: Small fix on COPY ON_ERROR document

From: Yugo NAGATA <nagata(at)sraoss(dot)co(dot)jp>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Small fix on COPY ON_ERROR document
Date: 2024-01-26 09:30:05
Message-ID: 20240126183005.b6c2688f66e701f187008338@sraoss.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, 26 Jan 2024 00:00:57 -0700
"David G. Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> wrote:

> On Thursday, January 25, 2024, Yugo NAGATA <nagata(at)sraoss(dot)co(dot)jp> wrote:
>
> >
> > 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.)
> >
>
> I’d lean more toward saying:
>
> Copy from can be instructed to ignore errors that arise from casting input
> data to the data types of the target columns by setting the on_error option
> to ignore. Skipping the entire input row in the process.
>
> The last part is because another way to ignore would be to set null values
> for those columns.

That makes sense. Is is a bit ambiguous to just say "skips malformed data";
it might be unclear for users if the data in the problematic column is skipped
(NULL is set) or the entire row is skipped. Also, setting null values for those
columns could be a future feature of ON_ERROR option.
>
> That a command stops on an error is the assumed behavior throughout the
> system, writing “copy stops operation at the first error.” just seems
> really unnecessary.

I think we need to describe this default behavior explicitly somewhere,
as you suggested in the other post [1].

[1] https://www.postgresql.org/message-id/CAKFQuwZJZ6uaS2B7qpL2FJzWBsnDdzgtbsW3pH9zuT6vC3fH%2Bg%40mail.gmail.com

Regards,
Yugo Nagata

> I will need to make this tweak and probably a couple others to my own
> suggestions in 12 hours or so.
>
> David J.

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message torikoshia 2024-01-26 09:49:10 Add new COPY option REJECT_LIMIT
Previous Message Michael Paquier 2024-01-26 09:22:41 Re: Fwd: BUG #18016: REINDEX TABLE failure