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 1rXGAR-009bYm-2e for pgsql-hackers@arkaria.postgresql.org; Tue, 06 Feb 2024 07:46:55 +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 1rXGAQ-001Ysk-7F for pgsql-hackers@arkaria.postgresql.org; Tue, 06 Feb 2024 07:46:54 +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 1rXGAP-001Ysc-UA for pgsql-hackers@lists.postgresql.org; Tue, 06 Feb 2024 07:46:53 +0000 Received: from ml.sraoss.co.jp ([66.11.59.17]) by magus.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rXGAI-005ita-Kp for pgsql-hackers@lists.postgresql.org; Tue, 06 Feb 2024 07:46:53 +0000 Received: from sranhm.sraoss.co.jp (unknown [192.168.174.164]) by osspc26.sraoss.co.jp (Postfix) with ESMTP id 40E212F00094; Tue, 6 Feb 2024 16:46:42 +0900 (JST) Received: from yugon-CFSV7-1 (unknown [192.168.176.25]) by sranhm.sraoss.co.jp (Postfix) with SMTP id 11C743417C3; Tue, 6 Feb 2024 16:46:42 +0900 (JST) Date: Tue, 6 Feb 2024 16:46:41 +0900 From: Yugo NAGATA To: Kyotaro Horiguchi Cc: torikoshia@oss.nttdata.com, jian.universality@gmail.com, david.g.johnston@gmail.com, pgsql-hackers@lists.postgresql.org Subject: Re: Change COPY ... ON_ERROR ignore to ON_ERROR ignore_row Message-Id: <20240206164641.43d0793c5d82da27b5982ef5@sraoss.co.jp> In-Reply-To: <20240206.093909.1866377550429411676.horikyota.ntt@gmail.com> References: <04bf425ad1b15a4daefe96c478a5253b@oss.nttdata.com> <20240205172256.0942c4e8b757fc6f7c4dbfa8@sraoss.co.jp> <20240206.093909.1866377550429411676.horikyota.ntt@gmail.com> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, 06 Feb 2024 09:39:09 +0900 (JST) Kyotaro Horiguchi wrote: > At Mon, 5 Feb 2024 17:22:56 +0900, Yugo NAGATA wrote in > > On Mon, 05 Feb 2024 11:28:59 +0900 > > torikoshia wrote: > > > > > > Based on this, I've made a patch. > > > > based on COPY Synopsis: ON_ERROR 'error_action' > > > > on_error 'null', the keyword NULL should be single quoted. > > > > > > As you mentioned, single quotation seems a little odd.. > > > > > > I'm not sure what is the best name and syntax for this feature, but > > > since current error_action are verbs('stop' and 'ignore'), I feel 'null' > > > might not be appropriate. > > > > I am not in favour of using 'null' either, so I suggested to use > > "set_to_null" or more generic syntax like "set_to (col, val)" in my > > previous post[1], although I'm not convinced what is the best either. > > > > [1] https://www.postgresql.org/message-id/20240129172858.ccb6c77c3be95a295e2b2b44%40sraoss.co.jp > > Tom sugggested using a separate option, and I agree with the > suggestion. Taking this into consideration, I imagined something like > the following, for example. Although I'm not sure we are actually > going to do whole-tuple replacement, the action name in this example > has the suffix '-column'. > > COPY (on_error 'replace-colomn', replacement 'null') .. Thank you for your information. I've found a post[1] you mentioned, where adding a separate option for error log destination was suggested. Considering consistency with other options, adding a separate option would be better if we want to specify a value to replace the invalid value, without introducing a complex syntax that allows options with more than one parameters. Maybe, if we allow to use values for the replacement other than NULL, we have to also add a option to specify a column (or a type) for each replacement value. Or, we may add a option to specify a list of replacement values as many as the number of columns, each of whose default is NULL. Anyway, I prefer 'replace" (or 'set_to') to just 'null' as the option value. [1] https://www.postgresql.org/message-id/2070915.1705527477%40sss.pgh.pa.us Regards, Yugo Nagata > regards. > > -- > Kyotaro Horiguchi > NTT Open Source Software Center -- Yugo NAGATA