Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gfPI1-0007AP-7g for pgsql-bugs@arkaria.postgresql.org; Fri, 04 Jan 2019 13:13:29 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gfPHz-0001LW-Jh for pgsql-bugs@arkaria.postgresql.org; Fri, 04 Jan 2019 13:13:27 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gfPHy-0001JW-GU for pgsql-bugs@lists.postgresql.org; Fri, 04 Jan 2019 13:13:27 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gfPHv-00042i-Cy for pgsql-bugs@postgresql.org; Fri, 04 Jan 2019 13:13:26 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 03A5321B84; Fri, 4 Jan 2019 08:13:20 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Fri, 04 Jan 2019 08:13:20 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=imap.cc; h= subject:to:cc:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm2; bh=N 2wu7Ssg2a1p2oJpcQfmwr5mOURfhk40swyvJ8SCm50=; b=bhlJHzcNkp5Ol6Vvy gH51wi4gx+IxgA6NwIJ7RhfEeRE748XI5BUnAOZmixDBEcVdWpOFoYTMTJsHNW8B 1FiXaDyLr7EgOHdMu7FDZ9ojOJIeEbZcM6tGRKiVLdyfXmXIURA8p698XeyLA6BX KV3fYV1cm6DgBuXpyuKE9sOgFLt8lPfIbFf4IU/ezI0TL3cvbw7UvhTrIlhtgWZ5 Av8D2hRDfkq7gao9ilGHL/FjX4+Q9+tW0Ayn3VNyzx2oqb1DGLkOv1+9D2Kjbfxr j9UkCS8x7BO36A8x8qFXj+L4g9nf9yjnJw+iSg3qP21hZZPMJSevApIEXKW3gmwh LXk6Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=N2wu7Ssg2a1p2oJpcQfmwr5mOURfhk40swyvJ8SCm 50=; b=YgZhTEeR42p4r+MJBJ+GEu85/Lbj3+XI/l1MfxVL/Mz9rNWF7kl87BKJb npKmbqw9sgDUyPDrmebtmZa9vZm26aeoceyGRs+4XAO5x7y6tkMzZ81yPTG98Ds1 ZIqgx6Du9eYMpao6jlYmwGlAwmYh39n5I2kmk3HvtI9rbA3CsElBJ80geZX+xHt4 kMYvzmFpY4FyuyqB9hTvuWS+n8tkxNsEwpegOWvEeTOvdJ/fOWPdMHikObsRIWlv yeORwFfnX+f3zadgdOKTLX4ileTau013z0W0Og4wqjFnbceDeMQDji10xycDbaDM zkDyQjiOXDeI0JgLPr3k0ZAvGMExg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrvddugdehtdculddtuddrgedtkedrtddtmd cutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthen uceurghilhhouhhtmecufedttdenucgfrhhlucfvnfffucdlfedtmdenucfjughrpefuvf hfhffkffgfgggjtgfgsehtkeertddtfeejnecuhfhrohhmpeetlhgvgigvhicuuegrshhh thgrnhhovhcuoegsrghshhhtrghnohhvsehimhgrphdrtggtqeenucfkphepudekhedrvd ehrdeffedrjedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegsrghshhhtrghnohhvsehi mhgrphdrtggtnecuvehluhhsthgvrhfuihiivgeptd X-ME-Proxy: Received: from [10.2.33.124] (unknown [185.25.33.70]) by mail.messagingengine.com (Postfix) with ESMTPA id 2EC6E10085; Fri, 4 Jan 2019 08:13:18 -0500 (EST) Subject: Re: Is temporary functions feature official/supported? Found some issues with it. To: Tom Lane Cc: pgsql-bugs@postgresql.org, alvherre@2ndquadrant.com, dimitri@citusdata.com References: <5d910e2e-0db8-ec06-dd5f-baec420513c3@imap.cc> <22938.1546456949@sss.pgh.pa.us> <52794060-3339-e699-a8d5-e3dd7c81fa95@imap.cc> <10857.1546467488@sss.pgh.pa.us> From: Alexey Bashtanov Message-ID: Date: Fri, 4 Jan 2019 13:13:15 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <10857.1546467488@sss.pgh.pa.us> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk > Hm. I can reproduce this if I start in a virgin database, but not > otherwise. for a database with a history of temporary namespaces we just need more parallel prepared transactions >  There's no reason this would be special to functions. temp functions are allowed in prepared transactions, unlike tables/views -- that's the reason I thought about functions Unfortunately I failed to reproduce a crash or a data corruption. The most interesting I could see was the following: --------example 1------- -- session 1: begin; create function pg_temp.foo() returns void as $$begin end;$$ language plpgsql; prepare transaction 'z'; create function pg_temp.foo() returns void as $$begin end;$$ language plpgsql; -- session 2: commit prepared 'z'; -- session 1 prints: -- ERROR:  duplicate key value violates unique constraint "pg_proc_proname_args_nsp_index" -- DETAIL:  Key (proname, proargtypes, pronamespace)=(foo, , 16385) already exists. --------example 2------- -- session 1: begin; create function pg_temp.foo() returns void as $$begin end;$$ language plpgsql; -- session 2: begin; create function pg_temp.foo() returns void as $$begin end;$$ language plpgsql; -- session 1: prepare transaction 'z'; \q -- session 2: prepare transaction 'y'; \q -- session 3: begin; create temp table t(); -- session 4: commit prepared 'z'; commit prepared 'y'; -- session 3 prints: -- ERROR:  duplicate key value violates unique constraint "pg_namespace_nspname_index" -- LINE 1: create temp table t(); --                           ^ -- DETAIL:  Key (nspname)=(pg_temp_3) already exists. Best,   Alex