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 1gfSCU-0002cP-Jz for pgsql-bugs@arkaria.postgresql.org; Fri, 04 Jan 2019 16:19:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gfSCT-0000Ev-An for pgsql-bugs@arkaria.postgresql.org; Fri, 04 Jan 2019 16:19:57 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gfSCS-00007F-Te for pgsql-bugs@lists.postgresql.org; Fri, 04 Jan 2019 16:19:57 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gfSCP-0004kA-D9 for pgsql-bugs@postgresql.org; Fri, 04 Jan 2019 16:19:55 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id x04GJlQv019830; Fri, 4 Jan 2019 11:19:47 -0500 From: Tom Lane To: Alvaro Herrera cc: Michael Paquier , Alexey Bashtanov , pgsql-bugs@postgresql.org, mmitar@gmail.com Subject: Re: Is temporary functions feature official/supported? Found some issues with it. In-reply-to: <201901041543.wdduitrlu2th@alvherre.pgsql> References: <201901041543.wdduitrlu2th@alvherre.pgsql> Comments: In-reply-to Alvaro Herrera message dated "Fri, 04 Jan 2019 12:43:37 -0300" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <19828.1546618787.1@sss.pgh.pa.us> Date: Fri, 04 Jan 2019 11:19:47 -0500 Message-ID: <19829.1546618787@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Alvaro Herrera writes: > On 2019-Jan-04, Michael Paquier wrote: >> That should not be allowed to commit directly. I think that we should >> just add a new value for MyXactFlags which tracks the transaction >> where the temporary namespace has been created, and generate an error >> if trying to use 2PC in this case. > That implies that a 2PC transaction will fail if it's run in a session > for which the temp namespace doesn't previously exist. I think it's a > fairly ugly failure mode, and one that normal testing will not catch > because it'll occur very rarely. An app that detects this problem at > run time will have to create a random temp object, commit normally, then > re-run the 2PC transaction from the start ... a lot of code to deal with > something that shouldn't happen in the first place. > I wonder if we can somehow create the temp schema in a way that makes it > immediately visible to everyone, and not depend on the commit status of > the creating transaction -- say mark the tuple with xmin=frozenXid or > something like ugly that. That's not sufficient to solve the problem, because there are really two issues here. Even if the temp schema already exists, we cannot allow a 2PC transaction to create/drop/lock objects in it, because that will mess things up for the surrounding session, or the next session to use the same temp schema: trying to clear out the schema will either fail or block. regards, tom lane