From: Michael Paquier <michael@paquier.xyz>
To: Laurenz Albe <laurenz.albe@cybertec.at>
Cc: P V Tekawade <pvtekawade@gmail.com>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: ON COMMIT options for non temporary tables
Date: Fri, 22 Nov 2019 16:27:09 +0900
Message-ID: <20191122072709.GD42684@paquier.xyz> (raw)
In-Reply-To: <b944e45c61ebb397693958e6927c4c235885e1d2.camel@cybertec.at>
References: <CAOxwpHA=9bPqPW3XJE3hQjvuuEyGcj+1W1dn8H=NG8jfAqXjwg@mail.gmail.com>
<b944e45c61ebb397693958e6927c4c235885e1d2.camel@cybertec.at>
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
Attachments:
signature.asc (application/pgp-signature, 832B) download
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: michael@paquier.xyz, laurenz.albe@cybertec.at, pvtekawade@gmail.com
Subject: Re: ON COMMIT options for non temporary tables
In-Reply-To: <20191122072709.GD42684@paquier.xyz>
References: <CAOxwpHA=9bPqPW3XJE3hQjvuuEyGcj+1W1dn8H=NG8jfAqXjwg@mail.gmail.com> <b944e45c61ebb397693958e6927c4c235885e1d2.camel@cybertec.at> <20191122072709.GD42684@paquier.xyz>
* 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