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 1guYeK-000672-Uo for pgsql-hackers@arkaria.postgresql.org; Fri, 15 Feb 2019 08:15:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1guYeI-0006II-KX for pgsql-hackers@arkaria.postgresql.org; Fri, 15 Feb 2019 08:15:06 +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 1guYeH-0006I7-NB for pgsql-hackers@lists.postgresql.org; Fri, 15 Feb 2019 08:15:06 +0000 Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1guYeA-0002H8-Sh for pgsql-hackers@lists.postgresql.org; Fri, 15 Feb 2019 08:15:05 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id CCAD42318E; Fri, 15 Feb 2019 03:14:57 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Fri, 15 Feb 2019 03:14:57 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm1; bh=wpcjboa8mepPyujNwxe3BpN9Ywf knrEv/q8zvemUVeA=; b=uxUgJEZMNyE6pF7guN2IltqkE9WAqk8u4ZHBWr1RbTu Lzrq+DUpOEvTIcsMQaUr0K4G5x3Kqf9jMce8qvIHlYVdX3d0EuWr6Gn6aiHy+qoJ gDym0g1//AmMnJFRIE7hVyP8cHqhCAmDIdgM1pXftj2R8n6wF1G/ebHN3q7NfpvF Di9O7b/9RIuP2zPoXDIJPE0q/RpfeojhSEchU6LpoeC+bYDg5Wm0AA0xJkSH9ODE MWhdOGU//Jaq9vBa0gYHkapn4xlwOOGouPXZimcEaumSRRsm+AJICaJPb8MMiMh3 gxsimdhlpYiB8KpPrOQdh44A3DarffPgFBxdupRxMGw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc: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=fm2; bh=wpcjbo a8mepPyujNwxe3BpN9YwfknrEv/q8zvemUVeA=; b=eMAte6Fj6ANbdw6t7d3rrq 2Ewag4tbUmMAgFTXsHYD2WJdfYdZOpKPMnmy4AskPLAzWNX7tsxg31VemoS71WZ1 bsEuP3ZTWOGEm1SbIfOuyALrwBZXNC302mDf6hqMyMOusbYj3nuLZ+ZM06UjXqIJ Vi15yOEynjoRZIlALMewqjbw++kQWzz0QyjeH2U8OEI09cT9JQTo6LS7xqDnNFPl IXV9UmBaV3PZfkCHVNi187VL1kD4I69KoU0OcX7PyzTTS/GOyoOK2kasVLu38HTT 9U7GAhavH8gsro4AXisGav9+iXEHLIS4cMmI649RpcMYB5Sj38BajdIfKlmWdt9A == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledruddtiedgudduhecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecu fedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnegfrhhlucfvnfffucdlje dtmdenucfjughrpeffhffvuffkfhggtggujgesghdtreertddtvdenucfhrhhomhepofhi tghhrggvlhcurfgrqhhuihgvrhcuoehmihgthhgrvghlsehprghquhhivghrrdighiiiqe enucfkphepiedurddvudehrddufeejrdduiedvnecurfgrrhgrmhepmhgrihhlfhhrohhm pehmihgthhgrvghlsehprghquhhivghrrdighiiinecuvehluhhsthgvrhfuihiivgeptd X-ME-Proxy: Received: from paquier.xyz (c137162.net61215.cablenet.ne.jp [61.215.137.162]) by mail.messagingengine.com (Postfix) with ESMTPA id 53B48E4559; Fri, 15 Feb 2019 03:14:56 -0500 (EST) Date: Fri, 15 Feb 2019 17:14:51 +0900 From: Michael Paquier To: Andreas Karlsson Cc: PostgreSQL Developers Subject: Re: Add missing CREATE TABLE IF NOT EXISTS table_name AS EXECUTE query; Message-ID: <20190215081451.GD2240@paquier.xyz> References: <2ddcc188-e37c-a0be-32bf-a56b07c3559e@proxel.se> <20190206114912.GE14980@paquier.xyz> <2c6f2b5b-a673-fd1c-ad9c-1c7676cee7d6@proxel.se> <20190207013135.GD4074@paquier.xyz> <20190211125359.GB3981@paquier.xyz> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="NtwzykIc2mflq5ck" Content-Disposition: inline In-Reply-To: <20190211125359.GB3981@paquier.xyz> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --NtwzykIc2mflq5ck Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Mon, Feb 11, 2019 at 09:53:59PM +0900, Michael Paquier wrote: > Let's wait a bit more than the beginning of this week. I forgot about > this week's minor release, and it is too late to do something about > this report now, so we will have to wait until the release had > happened. OK, committed down to 9.5. Another thing I have noticed is the following, which is kind of funky (just rinse and repeat once): =# EXPLAIN ANALYZE CREATE TABLE IF NOT EXISTS ac AS SELECT 1; ERROR: 42P07: relation "ac" already exists LOCATION: heap_create_with_catalog, heap.c:1111 The issue here is that we check for IF NOT EXISTS at the high level of ExecCreateTableAs, however EXPLAIN takes the lower path of create_ctas_internal() which enforces if_not_exists to false when building the CreateStmt object to create the relation. This brings out a more interesting issue: how should an EXPLAIN behave in this case? It has nothing to output as the relation already exists. -- Michael --NtwzykIc2mflq5ck Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAlxmdPsACgkQnvQgOdby QH1qaw//QQtov8F64BmB/KMwylbkbZk2LwLnMJjzxHxisiZvMKmw5XtXuhGtc91J MJGf7vwMLXVHToTl2m180hXDb1HDmsO+wf8YPT3Bs5rtUVADJpH0JdAFqs5xTG4m CtbRhUn+y+Qu1mozedxpJ3GCdhuNToEzKQ52BL6DsXrrliIyDkU19iN55apVoNc/ QA7mCcNmb503EvzCzLfI2s0PpwpMBtMmWm+n1wVJAtYWVy6ViNQbwUOVqyxcPQMW DxQv27tRGwKIV8x8wB/cAOa3vmKz2fR/2neWBWakN8eRfCpsAcQEOGJmTnrRXZ6N 5mH6HztQ8jTXY0it7Ngm5u9LLetZEr7r1IBMcUIFEvXog+DU3D9KdjHmTql7JBlt XEpe77507tDlXeOKx4X/HY2vN6jeOvpxxxd2nMecY7mLk0SwqlA0zXuQW58fEUdY mGYnHYy+Ju545h6bHWsNMy+A08Zqyxlj7e5s/YE+9Dop8TlVg6/QLtKerdXQ3Hay m8lDBGJigeFmK6TLAj7xjClcyKuYQ+5Ina+jgbcUzbEhspPTFoqQG4E1R/haO9kz TdpvW1+Dr4w7b4fCBkKIm4uhs8Y64WAaahxW1EUPDr7chtZQYe60KnW9XhKnaq5+ UPqK7mc/x0qtoTySjoQ8gEmO+akgLxQY+xfbxz2EF7faYrS86ps= =aEk9 -----END PGP SIGNATURE----- --NtwzykIc2mflq5ck--