postgres.git / summary / log / commit / refs
commit 9b71ffa061d77af7302062df22099566fc6e16ae
Author: Michael Paquier <michael@paquier.xyz>
Date: Fri Nov 06 01:45:09 2026 +0000
First released in: 17.12, 18.7, 19.0
Revert "Fix use-after-free in COPY (ON_ERROR)"
This reverts commit 23e2a332dd24. It looks like it is going to need a
little bit more work, and v19 RC2 is close by.
Backpatch-through: 17
src/backend/commands/copyfromparse.c | 4 ----
src/test/regress/expected/copy2.out | 4 ----
src/test/regress/sql/copy2.sql | 6 ------
3 files changed, 14 deletions(-)
diff --git a/src/backend/commands/copyfromparse.c b/src/backend/commands/copyfromparse.c
index 129f1a1aff8..fedaf78ba5e 100644
--- a/src/backend/commands/copyfromparse.c
+++ b/src/backend/commands/copyfromparse.c
@@ -886,10 +886,6 @@ NextCopyFrom(CopyFromState cstate, ExprContext *econtext,
MemSet(nulls, true, num_phys_attrs * sizeof(bool));
MemSet(cstate->defaults, false, num_phys_attrs * sizeof(bool));
- /* Clear the current attribute for error messages. */
- cstate->cur_attname = NULL;
- cstate->cur_attval = NULL;
-
/* Get one row from source */
if (!cstate->routine->CopyFromOneRow(cstate, econtext, values, nulls))
return false;
diff --git a/src/test/regress/expected/copy2.out b/src/test/regress/expected/copy2.out
index 148399b75c6..e5f9540292f 100644
--- a/src/test/regress/expected/copy2.out
+++ b/src/test/regress/expected/copy2.out
@@ -808,10 +808,6 @@ CONTEXT: COPY hard_err, line 1, column foo: "1"
COPY check_ign_err FROM STDIN WITH (on_error ignore);
ERROR: missing data for column "k"
CONTEXT: COPY check_ign_err, line 1: "1 {1}"
--- test extra data after a skipped row: should fail, reporting the line
-COPY check_ign_err FROM STDIN WITH (on_error ignore);
-ERROR: extra data after last expected column
-CONTEXT: COPY check_ign_err, line 2: "2 {2} 2 extra"
-- test extra data: should fail
COPY check_ign_err FROM STDIN WITH (on_error ignore);
ERROR: extra data after last expected column
diff --git a/src/test/regress/sql/copy2.sql b/src/test/regress/sql/copy2.sql
index bbc5dd7e1eb..b2cfe6523a6 100644
--- a/src/test/regress/sql/copy2.sql
+++ b/src/test/regress/sql/copy2.sql
@@ -610,12 +610,6 @@ COPY check_ign_err FROM STDIN WITH (on_error ignore);
1 {1}
\.
--- test extra data after a skipped row: should fail, reporting the line
-COPY check_ign_err FROM STDIN WITH (on_error ignore);
-1 {1} a
-2 {2} 2 extra
-\.
-
-- test extra data: should fail
COPY check_ign_err FROM STDIN WITH (on_error ignore);
1 {1} 3 abc
[parent: 2a5e2d2867ae]