Re: BUG #19844: COPY ON_ERROR set_null error context names the wrong column

From: Atisss hh <125atishprak(at)gmail(dot)com>
To: 125atishprak(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #19844: COPY ON_ERROR set_null error context names the wrong column
Date: 2026-11-07 14:16:03
Message-ID: CAGqfTttF6mNmke2WGwD2Gt7F_ZRk9QnQKouKEZF2On88b8iObA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Sat, 7 Nov 2026 at 19:45, PG Bug reporting form <noreply(at)postgresql(dot)org>
wrote:

> The following bug has been logged on the website:
>
> Bug reference: 19844
> Logged by: Atish Prakash
> Email address: 125atishprak(at)gmail(dot)com
> PostgreSQL version: 19rc1
> Operating system: Linux x86_64
> Description:
>
> When ON_ERROR set_null replaces a value in the last column of a row, a
> later
> error for that row still reports that column in its CONTEXT line, even
> though
> the error has nothing to do with it:
>
> CREATE TABLE zp(a int, b int) PARTITION BY LIST (a);
> CREATE TABLE zp1 PARTITION OF zp FOR VALUES IN (1);
>
> COPY zp FROM STDIN (ON_ERROR set_null);
> 9 x
> \.
>
> Actual output:
>
> ERROR: no partition of relation "zp" found for row
> DETAIL: Partition key of the failing row contains (a) = (9).
> CONTEXT: COPY zp, line 1, column b: "x"
>
> Expected: the context does not blame column b, whose value was handled,
> since
> the failing partition key is column a:
>
> CONTEXT: COPY zp, line 1: "9 x"
>
> in NextCopyFrom(), the set_null path does "continue" before the
> statements that reset cstate->cur_attname and cur_attval. If the failing
> field
> is the last one, they stay set for the rest of the row's processing.
>
> A possible patch is attached (0001-fix-copy-set-null-error-context.patch),
> which
> removes that "continue" so the reset always runs. Regression tests pass
> with
> it
> on master; it adds no new test.
>
> Found with semantic differential tests . I reproduced and checked the
> result
> myself.
>
>
>

Attachment Content-Type Size
0001-fix-copy-set-null-error-context.patch text/x-patch 491 bytes

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message PG Bug reporting form 2026-11-07 14:19:57 BUG #19845: pg_dump extended stats break when column numbers change on restore
Previous Message Atisss hh 2026-11-07 14:14:48 Re: BUG #19843: decode(..., 'base64url') returns an extra byte for "ab="