On Thu, Nov 05, 2026 at 02:43:54PM +0800, Chao Li wrote:
> So the fix is simple: we can add the cleanup in the
> COPY_ON_ERROR_IGNORE branch and remove the COPY_ON_ERROR_SET_NULL
> branch, letting it fall through so that the cleanup is performed.

I've also wondered exactly about that a couple of hours ago while
looking at a different bug in the same area of the code..  Interesting
timing.

I don't buy that the current coding on HEAD is correct, based on what
I can see here from this test:
* SQL input:
CREATE TABLE check_ign_err (n int, m int[], k int);
COPY check_ign_err FROM STDIN WITH (on_error ignore);
bad     {1}     3
1       {1}     3       abc
\.

* HEAD:
ERROR:  22P04: extra data after last expected column
CONTEXT:  COPY check_ign_err, line 2, column n: "1"
* with your patch:
ERROR:  22P04: extra data after last expected column
CONTEXT:  COPY check_ign_err, line 2: "1 {1} 3 4" 

Complaining about the first column on the second line is incorrect and
gets fed from the first incorrect line: we have extra fields on this
line, they should be mentioned.
--
Michael

Attachment: signature.asc
Description: PGP signature

Reply via email to