Re: BUG #15061: Cannot use TEMP TABLE ON COMMIT DROP in extension

From: Christoph Berg <myon(at)debian(dot)org>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #15061: Cannot use TEMP TABLE ON COMMIT DROP in extension
Date: 2018-02-22 09:41:52
Message-ID: 20180222094152.GA16878@msg.df7cb.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Re: Michael Paquier 2018-02-13 <20180213052732(dot)GF2915(at)paquier(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Claudio Freire 2018-02-22 11:27:11 Re: pg_upgrade and materialized views
Previous Message 趙明春 2018-02-22 08:24:35 Re: BUG #15076: postmaster crashes unexpectedly when using up arrow key in psql command