Re: Change COPY ... ON_ERROR ignore to ON_ERROR ignore_row
jian he <jian.universality@gmail.com>
From: jian he <jian.universality@gmail.com>
To: vignesh C <vignesh21@gmail.com>
Cc: Jim Jones <jim.jones@uni-muenster.de>,
Kirill Reshke <reshkekirill@gmail.com>, Fujii Masao <masao.fujii@oss.nttdata.com>, "David G. Johnston" <david.g.johnston@gmail.com>,
Yugo NAGATA <nagata@sraoss.co.jp>, torikoshia <torikoshia@oss.nttdata.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2025-04-04T11:55:04Z
Lists: pgsql-hackers
Attachments
- v15-0001-COPY-on_error-set_to_null.patch (text/x-patch) patch v15-0001
On Tue, Mar 25, 2025 at 2:31 PM vignesh C <vignesh21@gmail.com> wrote: > > 2) Here in error we say column c1 violates not-null constraint and in > the context we show column c2, should the context also display c2 > column: > postgres=# create table t3(c1 int not null, c2 int, check (c1 > 10)); > CREATE TABLE > postgres=# COPY t3 FROM STDIN WITH (on_error set_to_null); > Enter data to be copied followed by a newline. > End with a backslash and a period on a line by itself, or an EOF signal. > >> a b > >> \. > ERROR: null value in column "c1" of relation "t3" violates not-null constraint > DETAIL: Failing row contains (null, null). > CONTEXT: COPY t3, line 1, column c2: "b" > It took me a while to figure out why. with the attached, now the error message becomes: ERROR: null value in column "c1" of relation "t3" violates not-null constraint DETAIL: Failing row contains (null, null). CONTEXT: COPY t3, line 1: "a,b" while at it, (on_error set_to_null, log_verbosity verbose) error message CONTEXT will only emit out relation name, this aligns with (on_error ignore, log_verbosity verbose). one of the message out example: +NOTICE: column "b" was set to null due to data type incompatibility at line 2 +CONTEXT: COPY t_on_error_null > 3) typo becomen should be become: > null will becomen reserved to non-reserved fixed. > 4) There is a whitespace error while applying patch > Applying: COPY (on_error set_to_null) > .git/rebase-apply/patch:39: trailing whitespace. > a <literal>NOTICE</literal> message indicating the number of rows > warning: 1 line adds whitespace errors. fixed.
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
file_fdw: Add regression test for file_fdw with ON_ERROR='set_null'
- d8879d34b9dd 19 (unreleased) landed
-
Add COPY (on_error set_null) option
- 2a525cc97e19 19 (unreleased) landed
-
Add REJECT_LIMIT option to the COPY command.
- 4ac2a9beceb1 18.0 cited
-
Add log_verbosity = 'silent' support to COPY command.
- e7834a1a251d 18.0 cited
-
Add new COPY option LOG_VERBOSITY.
- f5a227895e17 17.0 cited