Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1eonO2-0007Hz-Q0 for pgsql-bugs@arkaria.postgresql.org; Thu, 22 Feb 2018 09:41:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eonO1-0001Sp-Oi for pgsql-bugs@arkaria.postgresql.org; Thu, 22 Feb 2018 09:41:57 +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_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1eonO1-0001Sg-J6 for pgsql-bugs@lists.postgresql.org; Thu, 22 Feb 2018 09:41:57 +0000 Received: from feynman.df7cb.de ([195.49.152.168]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1eonNy-0004S0-RK for pgsql-bugs@lists.postgresql.org; Thu, 22 Feb 2018 09:41:56 +0000 Received: from msg.df7cb.de (unknown [IPv6:2003:5b:203b:100:7627:eaff:fe52:8e03]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by feynman.df7cb.de (Postfix) with ESMTPSA id 3zn8Wj0Q9Rz3F2l; Thu, 22 Feb 2018 10:41:53 +0100 (CET) Date: Thu, 22 Feb 2018 10:41:52 +0100 From: Christoph Berg To: Michael Paquier Cc: pgsql-bugs@lists.postgresql.org Subject: Re: BUG #15061: Cannot use TEMP TABLE ON COMMIT DROP in extension Message-ID: <20180222094152.GA16878@msg.df7cb.de> References: <151845695673.1447.1976587386911561582@wrigleys.postgresql.org> <20180213052732.GF2915@paquier.xyz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180213052732.GF2915@paquier.xyz> User-Agent: Mutt/1.9.3 (2018-01-21) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Re: Michael Paquier 2018-02-13 <20180213052732.GF2915@paquier.xyz> > > 1) Explicitly drop the table within the .control file > > 2) Don't use ON COMMIT DROP (but that leaks the temp tables to the invoking > > session) > > One dirty trick I can think of here is to directly delete > the dependency within pg_depend, say in your extension script: > create temp table aa (a int); > delete from pg_depend where objid = 'aa'::regclass and refclassid = 'pg_extension'::regclass; "drop table aa" is much easier and cleaner anyway. > Have you actually thought about using unlogged tables? Keeping around > relation definitions is not a big deal usually for upgrade scenarios, > and temporary tables generate WAL, so if you move your data with a > two-step process you never want to generate the same WAL data twice, > making the upgrade perform faster. The table is only about 3000 rows, so speed is not a concern. Christoph