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 1pOtns-0004Zn-K3 for pgsql-hackers@arkaria.postgresql.org; Mon, 06 Feb 2023 05:12:32 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pOtnr-0002D4-71 for pgsql-hackers@arkaria.postgresql.org; Mon, 06 Feb 2023 05:12:31 +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 1pOtnq-0002Cu-U0 for pgsql-hackers@lists.postgresql.org; Mon, 06 Feb 2023 05:12:30 +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 1pOtno-0001cL-Ig for pgsql-hackers@postgresql.org; Mon, 06 Feb 2023 05:12:29 +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 3165CHKf2587471; Mon, 6 Feb 2023 00:12:17 -0500 From: Tom Lane To: Damir Belyalov cc: Andres Freund , 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: References: <686e46d6718f9535bc39fac7cad7408b@oss.nttdata.com> <769423519e16d18a1e7611c6931da58b@oss.nttdata.com> <20230205233723.xw5z5zmeyc57ezq3@alap3.anarazel.de> Comments: In-reply-to Damir Belyalov message dated "Mon, 06 Feb 2023 08:00:27 +0300" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2587469.1675660337.1@sss.pgh.pa.us> Date: Mon, 06 Feb 2023 00:12:17 -0500 Message-ID: <2587470.1675660337@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Damir Belyalov writes: >> I don't think this is the right approach. Creating a subtransaction for >> each row will cause substantial performance issues. > Subtransactions aren't created for each row. The block of rows in one > subtransaction is 1000 (SAFE_BUFFER_SIZE) and can be changed. I think that at this point, any patch that involves adding subtransactions to COPY is dead on arrival; whether it's batched or not is irrelevant. (It's not like batching has no downsides.) > 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. The major problem here has always been the indefinite amount of code implicated by calling datatype input functions, and we have now created a plausible answer to that problem. regards, tom lane