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 1grYXn-0006yz-Hb for pgsql-hackers@arkaria.postgresql.org; Thu, 07 Feb 2019 01:32:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1grYXk-0007Q6-Ge for pgsql-hackers@arkaria.postgresql.org; Thu, 07 Feb 2019 01:31:56 +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 1grYXi-0007Pz-BK for pgsql-hackers@lists.postgresql.org; Thu, 07 Feb 2019 01:31:56 +0000 Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1grYXa-0002OU-9l for pgsql-hackers@lists.postgresql.org; Thu, 07 Feb 2019 01:31:52 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 6999120CE1; Wed, 6 Feb 2019 20:31:45 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Wed, 06 Feb 2019 20:31:45 -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=fm3; bh=LMkJZtsOEb4AaZCTClT5yXW6Iz3 gPo+sTsR/kt3MUx8=; b=A7nPqtYfehZ11QxyD7UAGaxZqCDYoEwT9E+uFKrMLUz 30Xauv9a2Hgk/XCw7afNtx4JxWG48IeDtJMWaPdGvuXewA+7FiwB/kV2c6VdNX9A J4S1QP2OPPEuOVmak4Sc3MlCTfXPoTLbGzcw8ArISCApSsAYng/13U+u6PqtFqGf TyBwdfsl7/RZzx52yhHx2rGflWxTS0kktQidEi755ro1L5I3nTScHKHn049as7y9 0fGDALRd4qD9Djhv8lzqIn7s1SkN0k7kFN1Wy+UsF/za48u1WSspG/u0tdJFrRCn qz5opj/gm/L+676RzU8Fya+v+QqSn+n/jQrfJ85UHSg== 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=fm1; bh=LMkJZt sOEb4AaZCTClT5yXW6Iz3gPo+sTsR/kt3MUx8=; b=KC2aAyfVpSg6ixybt/J8LK tl65huWz5Stm55SCpoXoopYyxPDCYiSFjcnvt/wKjss4u7h6TRQiHY4vDy9ZZsGT a3dSTVWsBifrryb88GI6ImsBJ2Iij6g4E+RyW73uiOzP6LJHmOy/OISJ9QDqvFFc AuLDFPAGEtzdlJC2a+ipKttmrMmPsyzM9kqeu48u3Ku+WE7O0d586g8nF4Yq3oq1 3wZO8Tw5VulOGBl0mzaRpsel4AGKEphgj+EZZl+IatfFKOaByEjvf3R5HboD53xi 2hlmAyPO8qc9QFyoUzywuC5rUxD/YnEpCCqG4oEK3d0CBnh6745qOQXERc7slBEQ == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrkeelgdefvdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecufedt tdenucesvcftvggtihhpihgvnhhtshculddquddttddmnegfrhhlucfvnfffucdljedtmd enucfjughrpeffhffvuffkfhggtggujgesghdtreertddtvdenucfhrhhomhepofhitghh rggvlhcurfgrqhhuihgvrhcuoehmihgthhgrvghlsehprghquhhivghrrdighiiiqeenuc fkphepiedurddvudehrddufeejrdduiedvnecurfgrrhgrmhepmhgrihhlfhhrohhmpehm ihgthhgrvghlsehprghquhhivghrrdighiiinecuvehluhhsthgvrhfuihiivgeptd X-ME-Proxy: Received: from paquier.xyz (c137162.net61215.cablenet.ne.jp [61.215.137.162]) by mail.messagingengine.com (Postfix) with ESMTPA id 0CE11E4046; Wed, 6 Feb 2019 20:31:42 -0500 (EST) Date: Thu, 7 Feb 2019 10:31:35 +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: <20190207013135.GD4074@paquier.xyz> References: <2ddcc188-e37c-a0be-32bf-a56b07c3559e@proxel.se> <20190206114912.GE14980@paquier.xyz> <2c6f2b5b-a673-fd1c-ad9c-1c7676cee7d6@proxel.se> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="FFoLq8A0u+X9iRU8" Content-Disposition: inline In-Reply-To: <2c6f2b5b-a673-fd1c-ad9c-1c7676cee7d6@proxel.se> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --FFoLq8A0u+X9iRU8 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Wed, Feb 06, 2019 at 04:23:44PM +0100, Andreas Karlsson wrote: > I added a test in create_table.sql where the test for the other form of CTAS > IF NOT EXISTS is. Okay, we can live with that. Instead of a scan on pg_class, I would have switched to a more simple thing like that for the PREPARE query: PREPARE select1 AS SELECT 1 AS a; Then it would be good to add a scan on the created relation after running all the CREATE TABLE queries to make sure that it remains with only one tuple. > I have no idea if something like this should be back patched. I will add it > to the commit fest either way so it is not lost. I'd like to get that addressed before working on the other item reshuffling the CTAS relation creation. Let's wait for a couple of days and see if folks have objections, and then revisit it at the beginning of next week. CTAS IF NOT EXISTS is supported down to 9.5 and is documented as such, and my proposal is to back-patch accordingly. -- Michael --FFoLq8A0u+X9iRU8 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAlxbincACgkQnvQgOdby QH18gg/9EEnqAmogxINTMgkl+O/Q2HHDn225ubxC9pEKwb036q6hZLiREkwkQZD2 WJU4o2KZfm01662YuDw8WOH/8lxTpgCLje4G+EVwugIUnfxbq6cbMhfSz6cKkPJG 6z8zh9yYyZ4qEaPuvXxM8wR/e1a7B4wtv4sCKemqvfrNABDCXkpjn6i+kCgiOkmY 3Wpj1GKGoNGerlAPHriQF+0xmMnk1CF4oXAgMABAAOc672s4XWuhKkcJvAZxUCq2 SpXqeIIgB6+5fdkb034D+eBvtolkaW/Or8Ep4buWwbHqYQPDBjBh1kPSAHmNvdBe CHcVr4Odc4K6sGBPKZIVbNHBf2tEpywjRuYUCj5r/BfZQcK4bNhllrqsT7o+VT3K NbPg2yK8EBWMbdoturP9AXmQJdn2fw3Uz+uNHdX8fLRTde3JHblJGhUsVtyQyuNX 4kJ/henrcIBILhd37nbzE0Re7YVjN7+8RI71WL85EXzkDnHrQ9LijFWkGLRiqrZS vz9uJh5xraMeytGL0BDquXhoOdIXZ7nYPfB/z+1/gx1DGfyyN92ZxR8uUacZ9QXj DYWsKdwdZJUKKAcolEfE1nDlHd49o/089++2n6ZFPl8gUMwFgPI7SI/i6jtJpwgC o7HgxlbuAuZNGsaKFvUifiT806PRc0Z+SI41vx9SKK0oYWzrbV0= =rQFn -----END PGP SIGNATURE----- --FFoLq8A0u+X9iRU8--