pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Ignore inherited temp relations from other sessions when truncat
Date: Thu, 27 Dec 2018 01:19:54 +0000
Message-ID: <E1gcKL4-0005Cv-Cp@gemulon.postgresql.org> (raw)

Ignore inherited temp relations from other sessions when truncating

Inheritance trees can include temporary tables if the parent is
permanent, which makes possible the presence of multiple temporary
children from different sessions.  Trying to issue a TRUNCATE on the
parent in this scenario causes a failure, so similarly to any other
queries just ignore such cases, which makes TRUNCATE work
transparently.

This makes truncation behave similarly to any other DML query working on
the parent table with queries which need to be issues on children.  A
set of isolation tests is added to cover basic cases.

Reported-by: Zhou Digoal
Author: Amit Langote, Michael Paquier
Discussion: https://postgr.es/m/15565-ce67a48d0244436a@postgresql.org
Backpatch-through: 9.4

Branch
------
REL9_5_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/0a323ae6769968408d00ec1a9d1790706d5540fc

Modified Files
--------------
src/backend/commands/tablecmds.c             |  23 ++-
src/test/isolation/expected/inherit-temp.out | 217 +++++++++++++++++++++++++++
src/test/isolation/isolation_schedule        |   1 +
src/test/isolation/specs/inherit-temp.spec   |  78 ++++++++++
4 files changed, 316 insertions(+), 3 deletions(-)



view thread (6+ messages)  latest in thread

Message-ID: <E1gcKL4-0005Cv-Cp@gemulon.postgresql.org>
Permalink:  ../E1gcKL4-0005Cv-Cp@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1gcKL4-0005Cv-Cp@gemulon.postgresql.org

 · 

reply

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-committers@postgresql.org
  Cc: michael@paquier.xyz
  Subject: Re: pgsql: Ignore inherited temp relations from other sessions when truncat
  In-Reply-To: <E1gcKL4-0005Cv-Cp@gemulon.postgresql.org>
  References: <E1gcKL4-0005Cv-Cp@gemulon.postgresql.org>

* 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