Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pZMjU-0008LZ-8y for pgsql-hackers@arkaria.postgresql.org; Tue, 07 Mar 2023 02:07:16 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pZMjS-00022v-V6 for pgsql-hackers@arkaria.postgresql.org; Tue, 07 Mar 2023 02:07:14 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pZMjS-00022Z-LU for pgsql-hackers@lists.postgresql.org; Tue, 07 Mar 2023 02:07:14 +0000 Received: from oss.nttdata.com ([49.212.34.109]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pZMjP-00075Y-KB for pgsql-hackers@postgresql.org; Tue, 07 Mar 2023 02:07:13 +0000 Received: from oss.nttdata.com (localhost [127.0.0.1]) by oss.nttdata.com (Postfix) with ESMTPA id C81AA60207; Tue, 7 Mar 2023 11:07:07 +0900 (JST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.8 at oss.nttdata.com MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Date: Tue, 07 Mar 2023 11:07:07 +0900 From: torikoshia To: Daniel Gustafsson , dam.bel07@gmail.com Cc: PostgreSQL Hackers , Andres Freund , Danil Anisimow , HukuToc@gmail.com, a.lepikhov@postgrespro.ru, tgl@sss.pgh.pa.us Subject: Re: POC PATCH: copy from ... exceptions to: (was Re: VLDB Features) In-Reply-To: <0DE0602F-CC12-40ED-B259-3AB91FB02C3B@yesql.se> References: <686e46d6718f9535bc39fac7cad7408b@oss.nttdata.com> <769423519e16d18a1e7611c6931da58b@oss.nttdata.com> <20230205233723.xw5z5zmeyc57ezq3@alap3.anarazel.de> <2587470.1675660337@sss.pgh.pa.us> <483E1B59-4A80-450B-8685-7CC12762FD5A@anarazel.de> <2592557.1675663234@sss.pgh.pa.us> <39143e83571d59dfc04c75707fa0ea5a@oss.nttdata.com> <0DE0602F-CC12-40ED-B259-3AB91FB02C3B@yesql.se> User-Agent: Roundcube Webmail/1.4.11 Message-ID: <8ad8492ff9fae3481d87c7aab4e0aed0@oss.nttdata.com> X-Sender: torikoshia@oss.nttdata.com List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2023-03-06 23:03, Daniel Gustafsson wrote: >> On 28 Feb 2023, at 15:28, Damir Belyalov wrote: > >> Tested patch on all cases: CIM_SINGLE, CIM_MULTI, CIM_MULTI_CONDITION. >> As expected it works. >> Also added a description to copy.sgml and made a review on patch. Thanks for your tests and improvements! >> I added 'ignored_errors' integer parameter that should be output after >> the option is finished. >> All errors were added to the system logfile with full detailed >> context. Maybe it's better to log only error message. Certainly. > FWIW, Greenplum has a similar construct (but which also logs the errors > in the > db) where data type errors are skipped as long as the number of errors > don't > exceed a reject limit. If the reject limit is reached then the COPY > fails: > > LOG ERRORS [ SEGMENT REJECT LIMIT [ ROWS | PERCENT ]] > > IIRC the gist of this was to catch then the user copies the wrong input > data or > plain has a broken file. Rather than finding out after copying n rows > which > are likely to be garbage the process can be restarted. > > This version of the patch has a compiler error in the error message: > > copyfrom.c: In function ‘CopyFrom’: > copyfrom.c:1008:29: error: format ‘%ld’ expects argument of type ‘long > int’, but argument 2 has type ‘uint64’ {aka ‘long long unsigned int’} > [-Werror=format=] > 1008 | ereport(WARNING, errmsg("Errors: %ld", cstate->ignored_errors)); > | ^~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~ > | | > | uint64 {aka long > long unsigned int} > > > On that note though, it seems to me that this error message leaves a > bit to be > desired with regards to the level of detail. +1. I felt just logging "Error: %ld" would make people wonder the meaning of the %ld. Logging something like ""Error: %ld data type errors were found" might be clearer. -- Regards, -- Atsushi Torikoshi NTT DATA CORPORATION