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 1t51W2-003dF1-No for pgsql-hackers@arkaria.postgresql.org; Sun, 27 Oct 2024 11:33:02 +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 1t51W0-00G36G-1A for pgsql-hackers@arkaria.postgresql.org; Sun, 27 Oct 2024 11:33:00 +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.94.2) (envelope-from ) id 1t51Vz-00G368-NC for pgsql-hackers@lists.postgresql.org; Sun, 27 Oct 2024 11:33:00 +0000 Received: from mail-ua1-x933.google.com ([2607:f8b0:4864:20::933]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1t51Vx-0036ZZ-GH for pgsql-hackers@lists.postgresql.org; Sun, 27 Oct 2024 11:32:58 +0000 Received: by mail-ua1-x933.google.com with SMTP id a1e0cc1a2514c-84fb1225a89so946482241.2 for ; Sun, 27 Oct 2024 04:32:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730028776; x=1730633576; 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=IMru68m4LG19SY+Qzvl+jAPv7sFG93eVXSV57d1r2Dk=; b=aCCp+r2XSRB5RBnee9m2S40sraDPC6ki32eikTxBOhvA3JP4yz37d7hZPF+ExvWsxs mnAS23O0LVopmFPfjdGBVuYO1gqdDWwDAjZxtxcP8IvI8VNXFSb+eAIbIjhRmstSKkgG P6hyo7A1zpvxbzIrMrI53uWCmNAbBmK4KPjTXownEeM3MeOGhPrQPApE/uYny1Gh186/ Y0OlM+BJMhoAQjDtk7oTHEGWc/hsSI8B9dRCwnJA45GDDSZN7GABFLFhzEW2wQtuWshI 8Nn2ehXRgNVk1mE5RdcvMZYYUQwSmI3HpZKL4c91hXgO7GM/dwCcuDF1gRYZokiZWDDc 9MZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730028776; x=1730633576; 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=IMru68m4LG19SY+Qzvl+jAPv7sFG93eVXSV57d1r2Dk=; b=hrfQiYWzZr2KO1rBdnQu3GhI0hhoN8KZg+xar5FfHpsBnBN8dmQUy30kiPIOMwEWbf 1ry4zvoGrFaOLOJpwhY3YK0RVAFCRpXVZZu4k6+WT4P2b4ODEs8EXXEAwS5i1313hN7Y ILEAzCrugYAEt9ZpOZgr7b5AQ8gZuCs29tr0y1KG6Xw4AcqRjCUBz+0QHmd41jR5s+in OEAjKvq3ZOQVD+JbU2ItDVkzPLkCweo9XUBtJVLXixuzWTL6lTlA5YjmUywEpBlt9/wW gfzhK4Gzpa6FPrW+KDUvmd2sWEx+/wnhjQC8Iza5XCO21AtaUAxGiWQTrRn6Xjzc+IQO Qfsg== X-Forwarded-Encrypted: i=1; AJvYcCWr/6LLhKPT7Au/w/duDpWKUWrvv5JDZykpxUjYZnzk5XX68PMOyaWZmkMVdfWQDyDoKDdBgik2a/JogTWv@lists.postgresql.org X-Gm-Message-State: AOJu0YwB4Zp+bwFigqLNg3hfyzLBwf/1B8D6o0a7riCok5CXQHmoTKmX APVYyPqqRnzR6KYsGWYnq+H6Knk5DEcT+jKBa7gkX4P6A+R66ZcZSMgfl/9ivoVFXe4uKIDFqxE dfTetzOUhIzDbnkv/lL4lKi6nJrY= X-Google-Smtp-Source: AGHT+IGCadbd18H0xoXGLU+Dhr54URVJJ36lf6OqyaQmKoF/ZFmhaaxUj3bT7xAkGxaiDa7Q3k5KI2ohSQLQUv89dAE= X-Received: by 2002:a05:6102:358e:b0:4a5:6f41:211d with SMTP id ada2fe7eead31-4a8cfd56d89mr2616760137.24.1730028776590; Sun, 27 Oct 2024 04:32:56 -0700 (PDT) MIME-Version: 1.0 References: <20240129172858.ccb6c77c3be95a295e2b2b44@sraoss.co.jp> <04bf425ad1b15a4daefe96c478a5253b@oss.nttdata.com> <20240206191937.72eaf0ccc20cfea37944b422@sraoss.co.jp> <76da9fcc-93c5-4053-872e-12932a95356d@uni-muenster.de> <6eac5b45-7f45-4c7a-aae1-e90db8be2e08@uni-muenster.de> <3d6b5885-16a1-475d-b56f-41701c48d9d4@uni-muenster.de> <63595e8f-a245-4335-aa22-7e449a70e210@oss.nttdata.com> In-Reply-To: <63595e8f-a245-4335-aa22-7e449a70e210@oss.nttdata.com> From: jian he Date: Sun, 27 Oct 2024 19:32:45 +0800 Message-ID: Subject: Re: Change COPY ... ON_ERROR ignore to ON_ERROR ignore_row To: Fujii Masao Cc: Kirill Reshke , Jim Jones , "David G. Johnston" , Yugo NAGATA , torikoshia , 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, Oct 21, 2024 at 8:39=E2=80=AFPM Fujii Masao wrote: > On 2024/10/21 18:30, Kirill Reshke wrote: > > v4 no longer applies. It now conflicts with > > e7834a1a251d4a28245377f383ff20a657ba8262. > > Also, there were review comments. > > > > So, I decided to rebase. > > Thanks for the patch! Here are my review comments: > > I noticed that on_error=3Dset_to_null does not trigger NOTICE messages fo= r rows > and columns with errors. It's "unexpected" thing for columns to be silent= ly > replaced with NULL due to on_error=3Dset_to_null. So, similar to on_error= =3Dignore, > there should be NOTICE messages indicating which input records had column= s > set to NULL because of data type incompatibility. Without these messages, > users might not realize that some columns were set to NULL. > on_error=3Dset_to_null, we have two options for CopyFromStateData->num_errors. A. Counting the number of rows that on_error set_to_null happened. B. Counting number of times that on_error set_to_null happened let's say optionA: ereport(NOTICE, errmsg_plural("%llu row was converted to NULL due to data type incompatibility", "%llu rows were converted to NULL due to data type incompatibility", (unsigned long long) cstate->num_errors, (unsigned long long) cstate->num_errors)); I doubt the above message is accurate. "%llu row was converted to NULL" can mean "%llu row, for each row, all columns was converted to NULL" but here we are "%llu row, for each row, some column (can be all columns) was converted to = NULL" optionB: the message can be: errmsg_plural("converted to NULL due to data type incompatibility happened %llu time") but I aslo feel the wording is not perfect also. So overall I am not sure how to construct the NOTICE messages.