Re: Small fix on COPY ON_ERROR document - Mailing list pgsql-hackers

From Yugo NAGATA
Subject Re: Small fix on COPY ON_ERROR document
Date
Msg-id 20240126183005.b6c2688f66e701f187008338@sraoss.co.jp
Whole thread Raw
In response to Re: Small fix on COPY ON_ERROR document  ("David G. Johnston" <david.g.johnston@gmail.com>)
Responses Re: Small fix on COPY ON_ERROR document
List pgsql-hackers
On Fri, 26 Jan 2024 00:00:57 -0700
"David G. Johnston" <david.g.johnston@gmail.com> wrote:

> On Thursday, January 25, 2024, Yugo NAGATA <nagata@sraoss.co.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@sraoss.co.jp>



pgsql-hackers by date:

Previous
From: Yugo NAGATA
Date:
Subject: Re: Small fix on COPY ON_ERROR document
Next
From: torikoshia
Date:
Subject: Add new COPY option REJECT_LIMIT