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 1gkIVs-0000rd-Hr for pgsql-committers@arkaria.postgresql.org; Fri, 18 Jan 2019 01:00:01 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gkIVr-0006QT-8e for pgsql-committers@arkaria.postgresql.org; Fri, 18 Jan 2019 00:59:59 +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 1gkIVq-0006Ns-Bi for pgsql-committers@lists.postgresql.org; Fri, 18 Jan 2019 00:59:59 +0000 Received: from out5-smtp.messagingengine.com ([66.111.4.29]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gkIVn-0006AZ-8E for pgsql-committers@lists.postgresql.org; Fri, 18 Jan 2019 00:59:57 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 548AE286E7 for ; Thu, 17 Jan 2019 19:59:54 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 17 Jan 2019 19:59:54 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= date:from:to:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm3; bh=mHNpuUpTXMPoDRmAkWw72wk1Wha pa3CiMoBlTr6zOE4=; b=RwXfpe2nmGgVhbYuk16UF3p5WzXbo4/FU1xveWDEvDF 7lJGbu1yy1yT9QmkCVdsX9p3hFVqD4fYLPURyqWuFt6jwyBqKHUNvD2w2gB54VFq ygSbgI3DlO1AOggsJOHN2nMnTG1HeaBkQyEBQfF8G4rWdCdm2IrrNkWM2Fq0/Gt1 K6q8mg9+AKyHifvvDvJSyJr0r+eZNSBsXcftNLafKkl62mSywUF/e/0zk2TlPUIr pZ4royFcB6b67levdeJ6iAGVQ0X4MBsHId8uBjZ+LmDFTEqbWVKgcU9oqJOCxWwa xVUOXCtvS9nEh3tMG07D2mQELeYAb2LCGjeeW82Kgfw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=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=mHNpuU pTXMPoDRmAkWw72wk1Whapa3CiMoBlTr6zOE4=; b=bu9j9AvafhxZ4XOB8/jaR2 bIcDLsytVu13UjFjW5X+pJnHWFW3rfGi/KaFgQydVijTwc/p+ywwtWnlkReU5XLi 84FX23Hg3GOZ/NK0C9Hwjkqf04tovmIQq1jFBn6xHZFJbcGzcmREeyc7gm9R6GmD /zMUFOxy9GHcpkTyLwWJFPkyUgaQmr+cx7xxg+7tmqZv49TudV9ZZnxU1LAbOkqk KDVAh3hjTaCJFaXJ/j364YpDqpXwBqSCQBxu2SBCBLWuncxOOMSqRDxAcdyDeuqV O5h6ReCdgrANprn1yZPB0iTNWYZRx0Ul1aOADvTvxUWCFgDnB7W8gNJioNRiWfjg == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrgeelgddvkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecufedt tdenucgfrhhlucfvnfffucdlfeehmdenucfjughrpeffhffvuffkfhggtggujgesghdtre ertddtvdenucfhrhhomhepofhitghhrggvlhcurfgrqhhuihgvrhcuoehmihgthhgrvghl sehprghquhhivghrrdighiiiqeenucffohhmrghinhepphhoshhtghhrvghsqhhlrdhorh hgnecukfhppeeiuddrvdduhedrudefjedrudeivdenucfrrghrrghmpehmrghilhhfrhho mhepmhhitghhrggvlhesphgrqhhuihgvrhdrgiihiienucevlhhushhtvghrufhiiigvpe dt X-ME-Proxy: Received: from paquier.xyz (c137162.net61215.cablenet.ne.jp [61.215.137.162]) by mail.messagingengine.com (Postfix) with ESMTPA id BB006102A0 for ; Thu, 17 Jan 2019 19:59:52 -0500 (EST) Date: Fri, 18 Jan 2019 09:59:49 +0900 From: Michael Paquier To: pgsql-committers@lists.postgresql.org Subject: Re: pgsql: Restrict the use of temporary namespace in two-phase transaction Message-ID: <20190118005949.GD1883@paquier.xyz> References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="C1iGAkRnbeBonpVg" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --C1iGAkRnbeBonpVg Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Jan 18, 2019 at 12:22:52AM +0000, Michael Paquier wrote: > Restrict the use of temporary namespace in two-phase transactions >=20 > Attempting to use a temporary table within a two-phase transaction is > forbidden for ages. However, there have been uncovered grounds for > a couple of other object types and commands which work on temporary > objects with two-phase commit. In short, trying to create, lock or drop > an object on a temporary schema should not be authorized within a > two-phase transaction, as it would cause its state to create > dependencies with other sessions, causing all sorts of side effects with > the existing session or other sessions spawned later on trying to use > the same temporary schema name. I have been monitoring the buildfarm and crake is complaining: https://buildfarm.postgresql.org/cgi-bin/show_history.pl?nm=3Dcrake&br=3DHE= AD Here is the problem: SET search_path TO 'pg_temp'; BEGIN; SELECT current_schema() ~ 'pg_temp' AS is_temp_schema; - is_temp_schema ----------------- - t -(1 row) - +ERROR: cannot create temporary tables during a parallel operation PREPARE TRANSACTION 'twophase_search'; -ERROR: cannot PREPARE a transaction that has operated on temporary namesp= ace I am actually amazed to see the planner choose a parallel plan for that, and the test can be fixed by enforcing those parameters I think: SET max_parallel_workers =3D 0; SET max_parallel_workers_per_gather =3D 0; Could somebody confirm my assumption here by the way? This enforces a non-parallel plan, right? Anyway, it seems to me that this is pointing out to another issue: current_schema() can trigger a namespace creation, hence shouldn't we mark it as PARALLEL UNSAFE and make sure that we never run into this problem? -- Michael --C1iGAkRnbeBonpVg Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAlxBJQUACgkQnvQgOdby QH3wYxAApcrWNo/SM1bQHJqykS2hm+1U4Nx0i9IdFiEXfYiaAWAvj5+Zvh9EG8wu epPurQhJM8V554xgF0EYvM6bcAmS9yfhTBkh2YZPlrK3ND28qI1bB3j1RylWHb8M hb7fefSXULRDfq1oJ0gE6SidAkKLGRrAkcwB+Zni9s212qdnJmInxSaMmCnMvgiO oZJp++YQOnVAEWQmIBfTHm+2AT63VIe92uH7eQU5/9k8KcdMBPM61OrU23dsfQCD 8ltQ4eB4mZXM30Ib7h3Py6JRgw4zxM1Vs1/Suq9HUho2zkC8SvHhWQzRELtanM+R rFsQ0mCCQ+b71NS8QapYyqiTnPR+tg6JAEmOJlrduMhllwjUR/6tU2vR8/dXUA0t tkkCx3M92tIfySH2cTjtYKUPgwVXoFV0DRVeWx0Ud6o1kgqWx7supQjck38r3cX1 lhNXzYsigfCMlt7rtvOLtNdbhKjWUvFN33JSkladRdnR+tcSq8TZE47J1wSIeZnT 4zdZalH48iGrA97Xmg8yUiE6ZIiuI8zXkP0ROvqIwEqYTNbpcVLTIfss4b3W1MRn uI2Lk81Zg+DdwTj+h178IISdQVysyhQ0iRaKyZDJ2giAiPUwuqL3obC7w2y/fW6T 5E+dx8GKY2BFoyYw5bjGSIgji7i+e+bA9JWk6Pw0GRE/k0savRc= =Zgkf -----END PGP SIGNATURE----- --C1iGAkRnbeBonpVg--