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.94.2) (envelope-from ) id 1rWsRd-007dVr-Au for pgsql-hackers@arkaria.postgresql.org; Mon, 05 Feb 2024 06:27:05 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rWsRb-00BKYm-AY for pgsql-hackers@arkaria.postgresql.org; Mon, 05 Feb 2024 06:27:03 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rWsRa-00BKYd-UF for pgsql-hackers@lists.postgresql.org; Mon, 05 Feb 2024 06:27:03 +0000 Received: from mail-vk1-xa31.google.com ([2607:f8b0:4864:20::a31]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rWsRY-005XAN-CB for pgsql-hackers@lists.postgresql.org; Mon, 05 Feb 2024 06:27:02 +0000 Received: by mail-vk1-xa31.google.com with SMTP id 71dfb90a1353d-4c02bdc2892so372623e0c.1 for ; Sun, 04 Feb 2024 22:26:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707114417; x=1707719217; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=sKORU0ymRaMCFnrrAvstEzNYSyAblCQg00ObK6MIIJE=; b=bD2SbilvVeNmwzhK9ZtmdnTlY8pxUjTnDF+OMoHAjG+1uxl3rrEJRFRhJNKOeKU905 VcxjESkEKVbPh9F2c1zqfFafog+AEuYwYARMIvYyOwB38tcaGWCFbV3+lFbA91/P7SqD lICMcTTmCR+7ocAgKhS0ss1qCN4IueWNDILYHt+8mwwcEsLq8BkrWH9fsFPOKWNTPIxw 2Iah1A2gvb6lEZv8chthXdA+J3FBAqMhLriZG9tlA7riD/x5IDvdu87993mVaC7KwYs3 SN7xqs53hXcVfSsSU3xu7h5ghuQ1zqQhzAT4TwohF+zwiDhbkGdbcXBvpPSalUd8/aas SdpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707114417; x=1707719217; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sKORU0ymRaMCFnrrAvstEzNYSyAblCQg00ObK6MIIJE=; b=GZqKpV5lUL8CUS13DBqZvQtHWA+XwVUcpr07gzU8Tbf0UT5x7p7fy3wTtLNQ+RmVc1 m3Eqh29aPJqXNLDgW/qbb/6inEjvG3njyXuaEz4H1yUOxQOkx8bW8A/t1T5AwXG5g1zz qD7muqyCIGV+sn5UMPqhL+OpvefhDxq61G/hGKgy2+/rem3crV4vuF8O+NgylrZffW46 f7dQFaRlprewU+ws4un1nlcYL0Q4sBnJdd3QYO3fbne7hss3ZyAMB1M7ASgoNJ07jzJv oZpbHSQKL6VEB+xyL7UQek7hVo0VHy+Gs6aSoi5YNTsLa5Ihtt6eSBhQ9L/UjbaLi625 2Qyw== X-Gm-Message-State: AOJu0YwPfE47S6aTIeSh4vEpIwb9oyzleMZ4Egy0VQxTgvNzoJKe5omg ggY2I6+bfEOCv57ttEx6ASuL9PSPqXzYeI0/hcI2y9nK73jSM0pMN8pW0vSbhGtx4msapKy/wrj PAc9juSbYd+W9sTDWRP4qAmvXoQE= X-Google-Smtp-Source: AGHT+IGxqG7ueqWStClXClUIdBmSj/0n3QIuFSKifKK/4YUNCg0uHwJtfO1cmAS/OANW/pK4JDBPF3a2bxE17iS74e8= X-Received: by 2002:a05:6122:2883:b0:4b7:2382:b4 with SMTP id fl3-20020a056122288300b004b7238200b4mr3050157vkb.6.1707114417386; Sun, 04 Feb 2024 22:26:57 -0800 (PST) MIME-Version: 1.0 References: <20240129172858.ccb6c77c3be95a295e2b2b44@sraoss.co.jp> <04bf425ad1b15a4daefe96c478a5253b@oss.nttdata.com> In-Reply-To: <04bf425ad1b15a4daefe96c478a5253b@oss.nttdata.com> From: jian he Date: Mon, 5 Feb 2024 14:26:46 +0800 Message-ID: Subject: Re: Change COPY ... ON_ERROR ignore to ON_ERROR ignore_row To: torikoshia Cc: Yugo NAGATA , "David G. Johnston" , PostgreSQL Hackers Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, Feb 5, 2024 at 10:29=E2=80=AFAM torikoshia wrote: > > Hi, > > On 2024-02-03 15:22, jian he wrote: > > The idea of on_error is to tolerate errors, I think. > > if a column has a not null constraint, let it cannot be used with > > (on_error 'null') > > > + /* > > + * we can specify on_error 'null', but it can only apply to > > columns > > + * don't have not null constraint. > > + */ > > + if (att->attnotnull && cstate->opts.on_error =3D=3D > > COPY_ON_ERROR_NULL) > > + ereport(ERROR, > > + (errcode(ERRCODE_BAD_COPY_FILE_FORMAT), > > + errmsg("copy on_error 'null' cannot be used with > > not null constraint column"))); > > This means we cannot use ON_ERROR 'null' even when there is one column > which have NOT NULL constraint, i.e. primary key, right? > IMHO this is strong constraint and will decrease the opportunity to use > this feature. I don't want to fail in the middle of bulk inserts, so I thought immediately erroring out would be a great idea. Let's see what other people think.