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 1pOuYa-0006mj-1n for pgsql-hackers@arkaria.postgresql.org; Mon, 06 Feb 2023 06:00: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 1pOuYX-0006i8-QR for pgsql-hackers@arkaria.postgresql.org; Mon, 06 Feb 2023 06:00:45 +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 1pOuYX-0006hz-Gi for pgsql-hackers@lists.postgresql.org; Mon, 06 Feb 2023 06:00:45 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pOuYV-00028V-3y for pgsql-hackers@postgresql.org; Mon, 06 Feb 2023 06:00:44 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 31660Yoo2592558; Mon, 6 Feb 2023 01:00:34 -0500 From: Tom Lane To: Andres Freund cc: Damir Belyalov , Danil Anisimow , "HukuToc@gmail.com" , torikoshia , "a.lepikhov@postgrespro.ru" , PostgreSQL Hackers Subject: Re: POC PATCH: copy from ... exceptions to: (was Re: VLDB Features) In-reply-to: <483E1B59-4A80-450B-8685-7CC12762FD5A@anarazel.de> 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> Comments: In-reply-to Andres Freund message dated "Sun, 05 Feb 2023 21:52:33 -0800" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2592556.1675663234.1@sss.pgh.pa.us> Date: Mon, 06 Feb 2023 01:00:34 -0500 Message-ID: <2592557.1675663234@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Andres Freund writes: > On February 5, 2023 9:12:17 PM PST, Tom Lane wrote: >> Damir Belyalov writes: >>> InputFunctionCallSafe() is good for detecting errors from input-functions >>> but there are such errors from NextCopyFrom () that can not be detected >>> with InputFunctionCallSafe(), e.g. "wrong number of columns in row''. >> If you want to deal with those, then there's more work to be done to make >> those bits non-error-throwing. But there's a very finite amount of code >> involved and no obvious reason why it couldn't be done. > I'm not even sure it makes sense to avoid that kind of error. And > invalid column count or such is something quite different than failing > some data type input routine, or falling a constraint. I think it could be reasonable to put COPY's overall-line-format requirements on the same level as datatype input format violations. I agree that trying to trap every kind of error is a bad idea, for largely the same reason that the soft-input-errors patches only trap certain kinds of errors: it's too hard to tell whether an error is an "internal" error that it's scary to continue past. regards, tom lane