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 1pZBRM-0007Xy-7r for pgsql-hackers@arkaria.postgresql.org; Mon, 06 Mar 2023 14:03:48 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pZBRL-0006t4-2c for pgsql-hackers@arkaria.postgresql.org; Mon, 06 Mar 2023 14:03:47 +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 1pZBRK-0006rM-Ov for pgsql-hackers@lists.postgresql.org; Mon, 06 Mar 2023 14:03:46 +0000 Received: from smtp.outgoing.loopia.se ([93.188.3.37]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pZBRH-0000Wc-LD for pgsql-hackers@postgresql.org; Mon, 06 Mar 2023 14:03:45 +0000 Received: from s807.loopia.se (localhost [127.0.0.1]) by s807.loopia.se (Postfix) with ESMTP id 9368A2F7BE1D for ; Mon, 6 Mar 2023 15:03:40 +0100 (CET) Received: from s934.loopia.se (unknown [172.22.191.6]) by s807.loopia.se (Postfix) with ESMTP id 826192E2BA59; Mon, 6 Mar 2023 15:03:40 +0100 (CET) Received: from s473.loopia.se (unknown [172.22.191.6]) by s934.loopia.se (Postfix) with ESMTP id 7A1507CEA61; Mon, 6 Mar 2023 15:03:40 +0100 (CET) X-Virus-Scanned: amavisd-new at amavis.loopia.se X-Spam-Flag: NO X-Spam-Score: -1 X-Spam-Level: X-Spam-Status: No, score=-1 tagged_above=-999 required=6.2 tests=[ALL_TRUSTED=-1] autolearn=disabled Received: from s979.loopia.se ([172.22.191.5]) by s473.loopia.se (s473.loopia.se [172.22.190.13]) (amavisd-new, port 10024) with UTF8LMTP id IknnOlIf3isr; Mon, 6 Mar 2023 15:03:39 +0100 (CET) X-Loopia-Auth: user X-Loopia-User: daniel@yesql.se X-Loopia-Originating-IP: 89.255.232.193 Received: from smtpclient.apple (customer-89-255-232-193.stosn.net [89.255.232.193]) (Authenticated sender: daniel@yesql.se) by s979.loopia.se (Postfix) with ESMTPSA id 7270610BC39B; Mon, 6 Mar 2023 15:03:39 +0100 (CET) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.2\)) Subject: Re: POC PATCH: copy from ... exceptions to: (was Re: VLDB Features) From: Daniel Gustafsson In-Reply-To: Date: Mon, 6 Mar 2023 15:03:38 +0100 Cc: torikoshia , PostgreSQL Hackers , Andres Freund , Danil Anisimow , HukuToc@gmail.com, a.lepikhov@postgrespro.ru, tgl@sss.pgh.pa.us Content-Transfer-Encoding: quoted-printable Message-Id: <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> To: Damir Belyalov X-Mailer: Apple Mail (2.3696.120.41.1.2) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > 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. >=20 > 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. 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 =E2=80=98CopyFrom=E2=80=99: copyfrom.c:1008:29: error: format =E2=80=98%ld=E2=80=99 expects argument = of type =E2=80=98long int=E2=80=99, but argument 2 has type =E2=80=98uint6= 4=E2=80=99 {aka =E2=80=98long long unsigned int=E2=80=99} = [-Werror=3Dformat=3D] 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. -- Daniel Gustafsson