From: Tom Lane <tgl@sss.pgh.pa.us>
To: Huan Ruan <leohuanruan@gmail.com>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: PITR and Temp Tables
Date: Wed, 20 Apr 2022 09:36:14 -0400
Message-ID: <2781108.1650461774@sss.pgh.pa.us> (raw)
In-Reply-To: <CAGgcTZtrBfPGXKwsPwK9JKNJWHs5c-a2HmNubsAi5gFUFEYqKQ@mail.gmail.com>
References: <CAGgcTZtrBfPGXKwsPwK9JKNJWHs5c-a2HmNubsAi5gFUFEYqKQ@mail.gmail.com>
Huan Ruan <leohuanruan@gmail.com> writes:
> Let's say at T0 a database has N session based temp tables. They would have
> corresponding records in the catalog tables like pg_class and pg_attribute
> that are visible to other sessions.
> At T1, I do a PITR to T0. That recovered database should not have those
> temp tables because the sessions they were created in are not present. My
> question is what events trigger the deletion of those temp tables' catalog
> records (e.g. pg_class and pg_attribute etc.) in the recovered database?
Those records will still be there in the catalogs, yes.
Cleaning out the contents of a temporary schema is not the responsibility
of the WAL/recovery system. It's done by live backends at two times:
1. A session that has used a temp schema will normally clean out the
contained objects when it exits.
2. As a backstop in case #1 fails, a session that is about to begin using
a temp schema will clean out any surviving contents.
So if you rewound to a point where some temp objects exist, it'd be the
responsibility of the first session that wants to use a given temp schema
to clean out those objects.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: tgl@sss.pgh.pa.us, leohuanruan@gmail.com
Subject: Re: PITR and Temp Tables
In-Reply-To: <2781108.1650461774@sss.pgh.pa.us>
References: <CAGgcTZtrBfPGXKwsPwK9JKNJWHs5c-a2HmNubsAi5gFUFEYqKQ@mail.gmail.com> <2781108.1650461774@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox