postgres.git / summary / log / commit / refs
commit 160f31522793455152c803ab2700d64bbd60ddf1
Author: Michael Paquier <michael@paquier.xyz>
Date: Fri Nov 06 01:45:06 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 | 8 --------
src/test/regress/sql/copy2.sql | 11 -----------
3 files changed, 23 deletions(-)
diff --git a/src/backend/commands/copyfromparse.c b/src/backend/commands/copyfromparse.c
index 8951bd328ec..af45da46557 100644
--- a/src/backend/commands/copyfromparse.c
+++ b/src/backend/commands/copyfromparse.c
@@ -927,10 +927,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 690568db4be..df6fcd91799 100644
--- a/src/test/regress/expected/copy2.out
+++ b/src/test/regress/expected/copy2.out
@@ -830,10 +830,6 @@ CONTEXT: COPY t_on_error_null, line 1: "1,1"
COPY t_on_error_null FROM STDIN WITH (delimiter ',', on_error set_null);
ERROR: extra data after last expected column
CONTEXT: COPY t_on_error_null, line 1: "1,2,3,4"
--- fail, extra data after a row whose last column was set to null
-COPY t_on_error_null FROM STDIN WITH (delimiter ',', on_error set_null);
-ERROR: extra data after last expected column
-CONTEXT: COPY t_on_error_null, line 2: "1,2,3,4"
COPY t_on_error_null FROM STDIN WITH (on_error set_null, log_verbosity verbose); -- ok
NOTICE: setting to null due to data type incompatibility at line 1 for column "b": "x1"
CONTEXT: COPY t_on_error_null
@@ -887,10 +883,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 71b7e31dac5..ec6f5e8cfdc 100644
--- a/src/test/regress/sql/copy2.sql
+++ b/src/test/regress/sql/copy2.sql
@@ -628,11 +628,6 @@ COPY t_on_error_null FROM STDIN WITH (delimiter ',', on_error set_null);
COPY t_on_error_null FROM STDIN WITH (delimiter ',', on_error set_null);
1,2,3,4
\.
--- fail, extra data after a row whose last column was set to null
-COPY t_on_error_null FROM STDIN WITH (delimiter ',', on_error set_null);
-1,2,x
-1,2,3,4
-\.
COPY t_on_error_null FROM STDIN WITH (on_error set_null, log_verbosity verbose); -- ok
10 x1 yx
@@ -674,12 +669,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: a7b6055d4391]