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 1t2rhQ-0080mR-Uu for pgsql-hackers@arkaria.postgresql.org; Mon, 21 Oct 2024 12:39:52 +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 1t2rhM-007PCB-Rw for pgsql-hackers@arkaria.postgresql.org; Mon, 21 Oct 2024 12:39:49 +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 1t2rhM-007PC2-HA for pgsql-hackers@lists.postgresql.org; Mon, 21 Oct 2024 12:39:48 +0000 Received: from oss.nttdata.com ([49.212.34.109]) by magus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1t2rhJ-002DmJ-8F for pgsql-hackers@lists.postgresql.org; Mon, 21 Oct 2024 12:39:47 +0000 Received: from [192.168.11.3] (p3667168-ipxg13201funabasi.chiba.ocn.ne.jp [114.158.240.168]) by oss.nttdata.com (Postfix) with ESMTPSA id 0611F6010C; Mon, 21 Oct 2024 21:39:40 +0900 (JST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at oss.nttdata.com Message-ID: <63595e8f-a245-4335-aa22-7e449a70e210@oss.nttdata.com> Date: Mon, 21 Oct 2024 21:39:39 +0900 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Change COPY ... ON_ERROR ignore to ON_ERROR ignore_row To: Kirill Reshke , jian he Cc: Jim Jones , "David G. Johnston" , Yugo NAGATA , torikoshia , PostgreSQL Hackers 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> Content-Language: en-US From: Fujii Masao In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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=set_to_null does not trigger NOTICE messages for rows and columns with errors. It's "unexpected" thing for columns to be silently replaced with NULL due to on_error=set_to_null. So, similar to on_error=ignore, there should be NOTICE messages indicating which input records had columns set to NULL because of data type incompatibility. Without these messages, users might not realize that some columns were set to NULL. How should on_error=set_to_null behave when reject_limit is set? It seems intuitive to trigger an error if the number of rows with columns' data type issues exceeds reject_limit, similar to on_error=ignore. This is open to discussion. psql's tab-completion should be updated to include SET_TO_NULL. An error_action value of stop means fail the command, while ignore means discard the input row and continue with the next one. + set_to_null means the input value will be set to null and continue with the next one. How about merging these two descriptions to one and updating it to the following? ------------------- An error_action value of stop means fail the command, ignore means discard the input row and continue with the next one, and set_to_null means replace columns with invalid input values with NULL and move to the next row. ------------------- The ignore option is applicable only for COPY FROM This should be "... ignore and set_to_null options are ..."? Regards, -- Fujii Masao Advanced Computing Technology Center Research and Development Headquarters NTT DATA CORPORATION