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.96) (envelope-from ) id 1vidFK-00BkK0-2j for pgsql-hackers@arkaria.postgresql.org; Wed, 21 Jan 2026 18:48:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vidFK-008fUu-05 for pgsql-hackers@arkaria.postgresql.org; Wed, 21 Jan 2026 18:48:02 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vidFJ-008fUm-25 for pgsql-hackers@lists.postgresql.org; Wed, 21 Jan 2026 18:48:02 +0000 Received: from mail-dl1-x122f.google.com ([2607:f8b0:4864:20::122f]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vidFH-001dbz-1D for pgsql-hackers@lists.postgresql.org; Wed, 21 Jan 2026 18:48:01 +0000 Received: by mail-dl1-x122f.google.com with SMTP id a92af1059eb24-1220154725fso135684c88.0 for ; Wed, 21 Jan 2026 10:47:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1769021278; x=1769626078; darn=lists.postgresql.org; h=in-reply-to:references:subject:cc:to:from:message-id:date :content-transfer-encoding:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=74Hq97ur8pJ+hzsFvpO78/UzGfErBlvr2M7Ex2Hxevg=; b=M3puUhAdBHKKfGZ8gcOt0K7uKNLZ4ZeGqy+paAbgrDoUlif370Y+MD5vy/gSNVc0FR /7rBgSyCSy0wivbATlyeEFTwQjXnvyeu/bP9vc9sc4/RdPBrFNumkeC35fxeZH8ObOvv f87EVckRvF7m48USmzYk1MGFuFtzmpmzrBAA75LQE6qhubo2RaT6oVTFNDmkPDnIzQoL j3635jKA/nKEeg/s848gq6xkD3rn4MKewvYxI8LNhkBMA53wXZ19IWof0qC4KT/qlznV rpXzRdFfuCAaU61zt8KT5kSLTMJTZvIm7v6vV/NXBmr45H5fJ+c3cKtxEwdudBaxZhit xwFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769021278; x=1769626078; h=in-reply-to:references:subject:cc:to:from:message-id:date :content-transfer-encoding:mime-version:x-gm-gg:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=74Hq97ur8pJ+hzsFvpO78/UzGfErBlvr2M7Ex2Hxevg=; b=HR7p00msYvRuu/To9Cb/RO8YMMvL3x+ZvcryKU6LwWEuc03z+PKiUA06atqd8WwbzR pckugNKtb01FIHvTHt6OmcR4KQjOcJREiZD8z1NwL/wqwkHlWLIZXZxn/Wzpd67GgD0p frpHdbQx68kjxhdCCmrTE9JnqfqE3fIGZuhlJWKO29mQd0W72y/EOYXhujRfp8xAdAoy xZzZ3ZnBNimRkuYABw3zKFtffrmYBcVtilVrRZjNeqLECsiMFO8Wy4FAijcHNBHK4mm8 Xpg7P3k0ASEFOCr4J8TVdUdq4C3IhfZ15y1gdxkBoWUQC2Tlgr3hMdsncvxY38Ft5Pvz PCWA== X-Forwarded-Encrypted: i=1; AJvYcCU1rXQ+VKQwQZWAAhpudSFbOYGtna943W6auHvZFEjtbunMBFuzFSGubdU0fugTUYlaEN6QWWZuI+cWWwsR@lists.postgresql.org X-Gm-Message-State: AOJu0YyU6sHpx+Fwwz2UT3ZDJrmBn2VS9PJ7UKYiboPVEsFyrVVWS6b1 /bDYeO6FrzAUlpOKLCRyJgqr4Cv/0uDkp8cMGYP8kgYRrFKyM910WShZ X-Gm-Gg: AZuq6aKaWmDU3grIR7MbvQg00l0fmJzfVahxSqlUng0D1YgQ6oHSHg9CTI3Y1IwS1c6 T6VCFXI+QGyTAqB8f2XfETBW+7z/0Fly7CLeq2FXCPqyhz3Odurb7tKDMoUxaz2GOt2SHJExq0X sSURVQDcLl//eiDcNRbxq4siLeH8dmWfL/4LDETone15Px8TQbBK7mw9N07QyyhmafFTQ8fYPfI sjCVq3ja/zK8q9bnGG1O6G79g0tVHE0IoAo5kiWQhoCGdWxdW7pO6UApkHSVQhVyaDchFUcP/9v OK1P2PKpKkJc2AqntQ/6uddMHl4YDCPQDCkqq+90VDo4JwdeBd86segtcCuB1ahzidPGLcuEzb7 m/JKyp9goipY6BdsDvE7etjJpxXp1WWJWf+VQQfaXZNm2Mkx2fMtAs54fDO9yv/0ZA9NuSVw2fr fGhK8UnhzoSPsT+xZ3mJwuGaBjvWlMAoNL6Q== X-Received: by 2002:a05:7022:4187:b0:123:2de5:344a with SMTP id a92af1059eb24-12476a6db11mr171841c88.5.1769021278051; Wed, 21 Jan 2026 10:47:58 -0800 (PST) Received: from localhost ([2804:14d:328a:a59c:c17d:6910:fa0e:112a]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-2b72441e008sm602007eec.2.2026.01.21.10.47.53 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 21 Jan 2026 10:47:57 -0800 (PST) Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Wed, 21 Jan 2026 15:47:51 -0300 Message-Id: From: "Matheus Alcantara" To: "jian he" Cc: "torikoshia" , "Masahiko Sawada" , "vignesh C" , "Jim Jones" , "Kirill Reshke" , "Fujii Masao" , "David G. Johnston" , "Yugo NAGATA" , "PostgreSQL Hackers" Subject: Re: Change COPY ... ON_ERROR ignore to ON_ERROR ignore_row X-Mailer: aerc 0.21.0 References: <901967e5-e5dc-42c6-b2bf-fb3a49d7e787@gmail.com> In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed Jan 21, 2026 at 4:37 AM -03, jian he wrote: > On Wed, Jan 21, 2026 at 3:55=E2=80=AFAM Matheus Alcantara > wrote: >> Hi, >> >> The patch needs a new rebase, could you please send a new version? > > sure. please check the attached. Thanks for the new version. I have some comments on this first round of review: + errmsg_plural("invalid values in %" PRIu64 " row was replaced with null d= ue to data type incompatibility", + "invalid values in %" PRIu64 " rows were replaced with null due to data= type incompatibility", I think that we could remove the "invalid values in" to make it consistency with the COPY_ON_ERROR_IGNORE NOTICE ---------- + cstate->domain_with_constraint =3D (bool *) palloc0(attr_count * sizeof(= bool)); I think that we can use palloc_array? ---------- Should FORCE_NOT_NULL be allowed to be used with ON_ERROR set_null? It seems to me that ON_ERROR set_null overwrite the FORCE_NOT_NULL behaviour: postgres=3D# create table t4(a int, b varchar(5)); CREATE TABLE postgres=3D# copy t4 from 'data.csv' with (FORCE_NOT_NULL(b), format csv, d= elimiter ',', NULL 'NULL', ON_ERROR set_null); NOTICE: invalid values in 2 rows were replaced with null due to data type = incompatibility COPY 5 postgres=3D# \pset null 'NULL' Null display is "NULL". postgres=3D# select * from t4; a | b ---+------ 1 | aaaa 2 | bbbb 2 | NULL 2 | NULL 5 | NULL (5 rows) Note that only the ccccc rows on .csv file was inserted with a NULL value on b column. The 5,NULL row was inserted with a "NULL" string as a value: postgres=3D# select * from t4 where b is null; a | b ---+------ 2 | NULL 2 | NULL (2 rows) The contents of data.csv: 1,aaaa 2,bbbb 2,ccccc 2,ccccc 5,NULL Perhaps we should block the usage of FORCE_NOT_NULL with ON_ERROR SET_NULL? ---------- On monitoring.sgml we have the following for pg_stat_progress_copy tuples_skipped: Number of tuples skipped because they contain malformed data. This counter only advances when a value other than stop is specified to the ON_ERROR IIUC we are not updating this view if we set a column to NULL due to an error, perhaps this documentation should be updated to mention that it will not be updated with ON_ERROR set_null? ---------- I may have missing something, but we are still considering implementing the REJECT_LIMIT + ON_ERROR set_null? -- Matheus Alcantara EDB: https://www.enterprisedb.com