Re: expand on_error ignore error handling scope - Mailing list pgsql-hackers

From torikoshia
Subject Re: expand on_error ignore error handling scope
Date
Msg-id 62cb7a5864a00e12bac0c055cdb0d7d7@oss.nttdata.com
Whole thread Raw
In response to expand on_error ignore error handling scope  (jian he <jian.universality@gmail.com>)
List pgsql-hackers
On 2025-04-30 09:00, jian he wrote:
> hi.
> 
> Currently, (on_error ignore) only handles data type incompatibility 
> errors.
> However, we can extend its functionality to also handle errors caused 
> by extra
> data (additional columns) or missing data (fewer columns), I think.
> 
> on_error is only applicable to non-binary formats.
> In non-binary formats (such as text and CSV), COPY FROM cut income 
> source row by
> row by newline.  This means that row boundaries are clearly defined.  
> If a
> line's contents cannot be successfully converted to the table's 
> columns, an
> error is raised.
> 
> Based on this, I think it's doable to let on_error ignore handling 
> missing and
> extra data errors.
> Hope I didn't miss anything.
> 
> previously feature request discussion: [1]
> [1]:
> https://postgr.es/m/CAEHBEOCqqkSitU5gx%3D8aHD3ZeLtRy-1eC%3DXs%3DxB-thFNR9JpYA%40mail.gmail.com
> 
> what do you think?

I've heard similar feedback from users who were surprised that setting 
on_error = ignore didn't suppress errors due to column count mismatches.
Supporting this case as well might make the feature more intuitive and 
helpful for users.

That said, there might be cases where users actually want column count 
mismatches to result in an error, even when on_error is set to ignore.
So perhaps it could be worth considering -- just as an idea -- whether 
we should allow more fine-grained control over which kinds of errors to 
ignore, e.g., adding a new option to what type of errors are ignored.

-- 
Regards,

--
Atsushi Torikoshi
Seconded from NTT DATA GROUP CORPORATION to SRA OSS K.K.



pgsql-hackers by date:

Previous
From: "Zhijie Hou (Fujitsu)"
Date:
Subject: RE: Conflict detection for update_deleted in logical replication
Next
From: "Hayato Kuroda (Fujitsu)"
Date:
Subject: RE: Missing program_XXX calling in pgbench tests