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 1gfQs5-0005Tp-IP for pgsql-bugs@arkaria.postgresql.org; Fri, 04 Jan 2019 14:54:49 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gfQs4-0004UY-A0 for pgsql-bugs@arkaria.postgresql.org; Fri, 04 Jan 2019 14:54:48 +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 1gfQs4-0004UO-00 for pgsql-bugs@lists.postgresql.org; Fri, 04 Jan 2019 14:54:48 +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 1gfQs1-0002mo-Hd for pgsql-bugs@postgresql.org; Fri, 04 Jan 2019 14:54:46 +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 x04Esdor009177; Fri, 4 Jan 2019 09:54:39 -0500 From: Tom Lane To: Michael Paquier cc: 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: <20190104131351.GF2067@paquier.xyz> 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> <20190104131351.GF2067@paquier.xyz> Comments: In-reply-to Michael Paquier message dated "Fri, 04 Jan 2019 22:13:51 +0900" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <9175.1546613679.1@sss.pgh.pa.us> Date: Fri, 04 Jan 2019 09:54:39 -0500 Message-ID: <9176.1546613679@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Michael Paquier writes: > On Wed, Jan 02, 2019 at 05:18:08PM -0500, Tom Lane wrote: >> Hm. I can reproduce this if I start in a virgin database, but not >> otherwise. I think the problem is that the prepared transaction has >> created the pg_temp_NN schema for its session, and therefore there >> is an uncommitted pg_namespace entry for that schema name, and the >> second session is also trying to create that schema (because it has >> the same backend ID) so it blocks waiting to see if that index >> entry commits. > 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. A separate flag looks necessary to > me so as we don't bump on "cannot PREPARE a transaction that has > operated on temporary tables" in this case. Hm, I had forgotten that we had such an error message. Really that restriction needs to apply to any object in the temp namespace, not only tables. regards, tom lane