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 1pOoZl-0006IZ-0G for pgsql-hackers@arkaria.postgresql.org; Sun, 05 Feb 2023 23:37:37 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pOoZj-0003ri-UZ for pgsql-hackers@arkaria.postgresql.org; Sun, 05 Feb 2023 23:37:35 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pOoZj-0003rZ-LX for pgsql-hackers@lists.postgresql.org; Sun, 05 Feb 2023 23:37:35 +0000 Received: from wout5-smtp.messagingengine.com ([64.147.123.21]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pOoZh-00012H-JS for pgsql-hackers@postgresql.org; Sun, 05 Feb 2023 23:37:35 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id 526AB32001BB; Sun, 5 Feb 2023 18:37:31 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Sun, 05 Feb 2023 18:37:31 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anarazel.de; h= cc:cc:content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to; s=fm3; t=1675640250; x=1675726650; bh=gKNbFkXUW0 h8Z/dJtwZN4aD6hTicfc8En56SBF7l8Bk=; b=KnIVifLQe57myzAXYbYYvbfqMM Tz5GE6DB6Pjsj/mm16mBWTbMnTSTRs4HUPXY6yKpfY2A9VBA8dmY7tLqowhBCKgT 3sQEXZU6oO9Ls9UECrz10OMcCiY3LyK306ZC7PxEN/YLA1nDk4kcc01dc/ehTU14 gmVPw0+ztkihGMw/w1ZA5hEFemKjQYDrYabnTQKJk6rkt8xkzETyx6vF8UT1b2G9 Uv5gdRJ5d9Q7U2VK7pNw3eP3l6OFFhH22TxbLoRo/nczPK/fYpjohtfru3FUrutX S1PLGTyCT0iC+akjfCuNQSic/kCrHkoIvM43Kz4A4kF92c0/1dq5eiepowWg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:feedback-id :feedback-id:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:sender:subject:subject:to:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; t=1675640250; x=1675726650; bh=gKNbFkXUW0h8Z/dJtwZN4aD6hTic fc8En56SBF7l8Bk=; b=eEpEWe2HjRHG/VimxWHG4tvOv1TXKnKiMXS0FoSArMQV I5EuDK4JDaGMZkQxAhLj5PHGS13lSWUO4flmIUrCP0gLuqyfbvZwj3yZvZh0sqSK duxKxQmkw6cr1jTbZCaZZ8TUploZw2gg7nsUlC87Is7blTVz8SP7bRsMVBgNkomf sQHOr20+TxfvffvcvDck2A6uXa6xqbBOftBW83jzshxYgRwVtXFCDHnNwfHqWuPM Wr/IA/FRvqzofpZ+ZClzfHxinmug9IUT0fSOuV3LNMi+4sVllUKq0yPywASu1qTW BXENOT9zr6YWpo3PKneFisZfgtZ4lmloI+xpNvxdCw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrudeghedguddtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkfhggtggujgesthdtredttddtvdenucfhrhhomheptehnughr vghsucfhrhgvuhhnugcuoegrnhgurhgvshesrghnrghrrgiivghlrdguvgeqnecuggftrf grthhtvghrnhepvdfffeevhfetveffgeeiteefhfdtvdffjeevhfeuteegleduheetvedu ieettddunecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomh eprghnughrvghssegrnhgrrhgriigvlhdruggv X-ME-Proxy: Feedback-ID: id4a34324:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 5 Feb 2023 18:37:28 -0500 (EST) Date: Sun, 5 Feb 2023 15:37:23 -0800 From: Andres Freund To: Damir Belyalov Cc: Danil Anisimow , "HukuToc@gmail.com" , torikoshia , "a.lepikhov@postgrespro.ru" , PostgreSQL Hackers Subject: Re: POC PATCH: copy from ... exceptions to: (was Re: VLDB Features) Message-ID: <20230205233723.xw5z5zmeyc57ezq3@alap3.anarazel.de> References: <686e46d6718f9535bc39fac7cad7408b@oss.nttdata.com> <769423519e16d18a1e7611c6931da58b@oss.nttdata.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk H, On 2023-02-03 13:27:24 +0300, Damir Belyalov wrote: > @@ -625,6 +628,173 @@ CopyMultiInsertInfoStore(CopyMultiInsertInfo *miinfo, ResultRelInfo *rri, > miinfo->bufferedBytes += tuplen; > } > > +/* > + * Safely reads source data, converts to a tuple and fills tuple buffer. > + * Skips some data in the case of failed conversion if data source for > + * a next tuple can be surely read without a danger. > + */ > +static bool > +SafeCopying(CopyFromState cstate, ExprContext *econtext, TupleTableSlot *myslot) > + BeginInternalSubTransaction(NULL); > + CurrentResourceOwner = sfcstate->oldowner; I don't think this is the right approach. Creating a subtransaction for each row will cause substantial performance issues. We now can call data type input functions without throwing errors, see InputFunctionCallSafe(). Use that to avoid throwing an error instead of catching it. Greetings, Andres Freund