Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xPjB6-00000000rgR-0DRn for pgsql-bugs@arkaria.postgresql.org; Sat, 07 Nov 2026 16:22:05 +0000 Received: from localhost ([127.0.0.1]:57122 helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.98.2) (envelope-from ) id 1xPirG-000000049lg-07JU for pgsql-bugs@arkaria.postgresql.org; Sat, 07 Nov 2026 16:01:34 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]:33286) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xPhCF-00000003amb-0zBH for pgsql-bugs@lists.postgresql.org; Sat, 07 Nov 2026 14:15:07 +0000 Received: from mahout.postgresql.org ([2001:4800:3e1:1::227]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xPhCC-00000000ifG-1pPz for pgsql-bugs@lists.postgresql.org; Sat, 07 Nov 2026 14:15:06 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=postgresql.org; s=20171124; h=Message-ID:Date:Reply-To:Cc:From:To:Subject: Content-Transfer-Encoding:MIME-Version:Content-Type:Sender:Content-ID: Content-Description:In-Reply-To:References; bh=K0WqxH1j6VUmJTZ1NrPkR0nDya3BCnAhUN6TDT8ndSo=; b=lIyyiAATRzILDHNQiOx7Jg+eHX yT4Yv7SUmWtQBgayxcgNL0E2sVFK6VHw5RLkv6r7CfMqKN+yVA+ZOwrGtPpTEsUxZsXIeE1a+OSl0 skq/Jihaj7dadGKJmb2D6RZ0p1Hcp6euN8+/OBIuTeAcXfvR+5rJQ604Qgw6Yyh9IYfZrE0L88ajo ythXTKdLZjrMJo/2gb8EtI4FCSBhuslnXNBP+PnJ9jxBvGSMhQZr8oS4Ci93N9ezB3fy6vEdrWEhl ojxuifdQpggXRHPZSHuLqYeDHJJfg3rKbXJ1s1DugYeVZ5+Kba5QyxcpjHTZrdKncUqBUSDxOUdI/ SK22Y4jA==; Received: from wrigleys.postgresql.org ([2a02:16a8:dc51::60]) by mahout.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1xPhCD-000000020Uf-1gtl for pgsql-bugs@lists.postgresql.org; Sat, 07 Nov 2026 14:15:05 +0000 Received: from localhost ([127.0.0.1] helo=wrigleys.postgresql.org) by wrigleys.postgresql.org with esmtp (Exim 4.98.2) (envelope-from ) id 1xPhCB-000000053nk-3m0u for pgsql-bugs@lists.postgresql.org; Sat, 07 Nov 2026 14:15:04 +0000 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: BUG #19844: COPY ON_ERROR set_null error context names the wrong column To: pgsql-bugs@lists.postgresql.org From: PG Bug reporting form Cc: 125atishprak@gmail.com Reply-To: 125atishprak@gmail.com, pgsql-bugs@lists.postgresql.org Date: Sat, 07 Nov 2026 14:14:15 +0000 Message-ID: <19844-eccbc58101e119c2@postgresql.org> X-Auto-Response-Suppress: All Auto-Submitted: auto-generated List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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: =20 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) =3D (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.