pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedBUG #19844: COPY ON_ERROR set_null error context names the wrong column
2+ messages / 2 participants
[nested] [flat]
* BUG #19844: COPY ON_ERROR set_null error context names the wrong column
@ 2026-11-07 14:14 PG Bug reporting form <noreply@postgresql.org>
0 siblings, 1 reply; 2+ messages in thread
From: PG Bug reporting form @ 2026-11-07 14:14 UTC (permalink / raw)
To: pgsql-bugs@lists.postgresql.org; +Cc: 125atishprak@gmail.com
The following bug has been logged on the website:
Bug reference: 19844
Logged by: Atish Prakash
Email address: 125atishprak@gmail.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.
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: BUG #19844: COPY ON_ERROR set_null error context names the wrong column
@ 2026-11-07 14:16 Atisss hh <125atishprak@gmail.com>
parent: PG Bug reporting form <noreply@postgresql.org>
0 siblings, 0 replies; 2+ messages in thread
From: Atisss hh @ 2026-11-07 14:16 UTC (permalink / raw)
To: 125atishprak@gmail.com; pgsql-bugs@lists.postgresql.org
On Sat, 7 Nov 2026 at 19:45, PG Bug reporting form <noreply@postgresql.org>
wrote:
> The following bug has been logged on the website:
>
> Bug reference: 19844
> Logged by: Atish Prakash
> Email address: 125atishprak@gmail.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.
>
>
>
Attachments:
0001-fix-copy-set-null-error-context.patch (text/x-patch, 491B) download
diff --git a/src/backend/commands/copyfromparse.c b/src/backend/commands/copyfromparse.c
index 0645053577..f7bbbc198f 100644
--- a/src/backend/commands/copyfromparse.c
+++ b/src/backend/commands/copyfromparse.c
@@ -1171,8 +1171,6 @@ CopyFromTextLikeOneRow(CopyFromState cstate, ExprContext *econtext,
if (cstate->opts.on_error == COPY_ON_ERROR_IGNORE)
return true;
- else if (cstate->opts.on_error == COPY_ON_ERROR_SET_NULL)
- continue;
}
cstate->cur_attname = NULL;
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2026-11-07 14:16 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-11-07 14:14 BUG #19844: COPY ON_ERROR set_null error context names the wrong column PG Bug reporting form <noreply@postgresql.org>
2026-11-07 14:16 ` Atisss hh <125atishprak@gmail.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox