Re: Temp table handling after anti-wraparound shutdown (Was: BUG #15840)

From: Andres Freund <andres(at)anarazel(dot)de>
To: Thierry Husson <thusson(at)informiciel(dot)com>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, Robert Haas <robertmhaas(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Temp table handling after anti-wraparound shutdown (Was: BUG #15840)
Date: 2019-06-09 21:31:26
Message-ID: 20190609213126.uutlkqlrsud3bdfs@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

Hi,

(on postgres lists, please do not top-quote).

On 2019-06-08 04:06:39 -0500, Thierry Husson wrote:
> In fact, I suppose all temporary tables and their content could be
> completly ignored by MVCC principles as they are not subject to
> concurrency being unmodifiable/unreadable by other connections.

That'd cause corruption, because vacuum would then remove resources that
the temp table might rely on (commit log, multixacts, ...).

> The separate situation, as noted by Michael, could be done at connection
> time, when PG gives a temporay schema to it. When it create a pg_temp_XXX
> schema, it could make sure it's completely empty and otherwise remove
> everything in it.

That already happens, but unfortunately only too late. IIRC We only do
so once the first temp table in a session is created.

> I already had a DB corruption because system tables weren't in sync
> about these tables/schemas after a badly closed connection, so it was
> impossible to make a drop table on them. So it could be even safer to
> clear everything directly from system tables instead of calling drop
> table for each leftover temp table.

Hm, I'd like to know more about that corruption. Did you report it when
it occured?

Greetings,

Andres Freund

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Fahar Abbas 2019-06-10 05:23:38 Re: BUG #15834: Cannot install npgsql driver
Previous Message Tom Lane 2019-06-09 15:14:01 Re: Test suite fails on macOS after update to 9.6.13 and 11.3

Browse pgsql-hackers by date

  From Date Subject
Next Message David Rowley 2019-06-09 23:45:17 Re: Custom table AMs need to include heapam.h because of BulkInsertState
Previous Message Siarhei Siniak 2019-06-09 18:05:20 GiST limits on contrib/cube with dimension > 100?