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 1iY3Li-0002L4-Ck for pgsql-general@arkaria.postgresql.org; Fri, 22 Nov 2019 07:27:26 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iY3Lg-0001RT-Q2 for pgsql-general@arkaria.postgresql.org; Fri, 22 Nov 2019 07:27:24 +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 1iY3Lg-0001O6-Dm for pgsql-general@lists.postgresql.org; Fri, 22 Nov 2019 07:27:24 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iY3Ld-0003NW-S6 for pgsql-general@lists.postgresql.org; Fri, 22 Nov 2019 07:27:24 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 1FF802332D; Fri, 22 Nov 2019 02:27:19 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Fri, 22 Nov 2019 02:27:19 -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=f2M8wzVzGf6eogoA8Mjtmq1uwg8 kxp1pvf+2/z8WMc4=; b=iIoq/eZeNMZ+ek3Ve6KYM4INJ4ZA9QM3JRUbaXZhztF QF2PLHPpj1tGMbg3vf+UOFihIz5L9LXuwRvHoxqNqqJvWzUi0WWVqQwHiJu9Q41p o3iwgt0dFYPAJhb4zxRcQ/RzaqKVcW57kN0T5/j77y7UbJCdcLNpsaHjbFKVn+Dt NwTOV8J7jgoEbVbDherW31OXJxVXt81+e55Sbrx00OiFFPv8jAp3gtmanlJDcgZr aa0vqQyjLM2RTT5gQjr10PFExs45WVeyZonw3HaCAEi71h7AXOMViNWrBs2B1T5X 6wIQWrYtNEmuUemcEnshZbRoLT57yFzdktD27qgtfGw== 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=f2M8wz VzGf6eogoA8Mjtmq1uwg8kxp1pvf+2/z8WMc4=; b=UxuVUiWTrSoohqZtr3TwH0 Yuz5nxL8bDfEAwHfp7qYi+li8BfKdi2rFoVc0++3mgZMgfuPYtJ+OxdoicM2mXIR h4RAw/SV1Mh7D2nrMNnfQaL9tLM606h0aIKg8t89jLzED/a+UfB22Uwj8HEsY/aQ jIyA13GgZpIuJQTmeQqnRHCifhA5+tEfpFXqkLwZGpEH0gykCg/R4afrwY72wuaD 4AlP3lyYsNvvlrNrbR3vN7ars78TSv8inYdyO9MrvwPhyPwAEEfRlyhJPNpt6SjR XHw+lR4XI+wrZIA9e1j3hW/lAVQix9ndeMF1mkf/QqYTT8FIUX50g5daM9Qp8cbQ == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedrudehfedguddtiecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enfghrlhcuvffnffculdejtddmnecujfgurhepfffhvffukfhfgggtuggjsehgtderredt tddvnecuhfhrohhmpefoihgthhgrvghlucfrrghquhhivghruceomhhitghhrggvlhesph grqhhuihgvrhdrgiihiieqnecukfhppeduuddurddutddvrddukedtrddukeehnecurfgr rhgrmhepmhgrihhlfhhrohhmpehmihgthhgrvghlsehprghquhhivghrrdighiiinecuve hluhhsthgvrhfuihiivgeptd X-ME-Proxy: Received: from paquier.xyz (ee0822lan1.rev.em-net.ne.jp [111.102.180.185]) by mail.messagingengine.com (Postfix) with ESMTPA id 72B5D306005F; Fri, 22 Nov 2019 02:27:17 -0500 (EST) Date: Fri, 22 Nov 2019 16:27:09 +0900 From: Michael Paquier To: Laurenz Albe Cc: P V Tekawade , pgsql-general@lists.postgresql.org Subject: Re: ON COMMIT options for non temporary tables Message-ID: <20191122072709.GD42684@paquier.xyz> References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="J4XPiPrVK1ev6Sgr" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --J4XPiPrVK1ev6Sgr Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Thu, Nov 21, 2019 at 05:13:31PM +0100, Laurenz Albe wrote: > How should that work for tables other than temporary tables? > Should COMMIT lock if somebody else accesses the table? Postgres does not support read uncommitted, so the table would not be visible to other sessions until the transaction that created it is committed. Anyway, the goal is to use the table just within a transaction without having it produce WAL, right? > What keeps you from explicitly dropping the table right before > you commit? Yeah, that would be the most simple. Another idea I can think of here is to use a combination of event trigger and deferred triggered on a dummy constraint: register the table creation using the event trigger on CREATE TABLE, and then drop it using the deferred trigger. Using a DROP TABLE before the commit or once your transaction is done with this table is much more simple of course :) -- Michael --J4XPiPrVK1ev6Sgr Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAl3Xjc0ACgkQnvQgOdby QH0+LQ//c1k+AW5tFiXG+ghi5MwzLXRBv75slGq7VXhS8nuzQTVXJEYTMOT03KtL bnmqQZn+JckXo0o+1auT5Xt+/NpqqMa2auaeomilIMg2OaOd5TE6TPsawZKF1vDX XjwjsoVFGSdikLRflgb3W/L4IbFnXZB/nsyX7n/P5A4WXqKUYikD5pYfwRNfZwJh JAtBeb4WpTPScQPz6DaJezw/wMOqXFlM2SK3MhIoRa8xVP1nTUAcymIbx7fhWTkZ NP1JW27PA/s45p6oGcU8MtXusKYxvrMcNaMI1BCL/4zYQ89k7QUJLPatdF6krpLc K00WDsnmxsRoGgrQi/a2zhtpNl2G5j+C303GIux0z+qBnCMJZQlMiJxlqPIyVCKZ 7itoAE0fxuG1jus6yZdw4Z1LYBdHyTj6iby5PvvEgF6KAILV256cKSia2IEBOKx6 tM5QwF/Uuf/t9Jdb51jJj4Dt616zcfO0oBaEswtqou2sNmmsnCOJIQyvrJvxXtrf yOFz0lgQ491oVByil/w3New8B2hJdTrGifQlOSm+4Uft0cSTwg1CnZI4gr9Whv5R QrsPDjTkcb7znFvmblq0UkQTCXiGPxfJqQmrGWKcfXnAL5vpsmlaP9kilvqOkrEr IRrcBgG8VKVryPFpk1wt5AosZrd3dgwiDpFNYERizsy1xBz1C3M= =Mk3u -----END PGP SIGNATURE----- --J4XPiPrVK1ev6Sgr--