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: Block creation of partitions with open references to its parent
Date: Mon, 05 Nov 2018 02:05:15 +0000
Message-ID: <E1gJUGR-0000yt-P4@gemulon.postgresql.org> (raw)

Block creation of partitions with open references to its parent

When a partition is created as part of a trigger processing, it is
possible that the partition which just gets created changes the
properties of the table the executor of the ongoing command relies on,
causing a subsequent crash.  This has been found possible when for
example using a BEFORE INSERT which creates a new partition for a
partitioned table being inserted to.

Any attempt to do so is blocked when working on a partition, with
regression tests added for both CREATE TABLE PARTITION OF and ALTER
TABLE ATTACH PARTITION.

Reported-by: Dmitry Shalashov
Author: Amit Langote
Reviewed-by: Michael Paquier, Tom Lane
Discussion: https://postgr.es/m/15437-3fe01ee66bd1bae1@postgresql.org
Backpatch-through: 10

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/dc3e436b191a8f8d6f35fad952dd3dc314ccabf9

Modified Files
--------------
src/backend/commands/tablecmds.c           |  8 ++++++++
src/test/regress/expected/alter_table.out  | 18 ++++++++++++++++++
src/test/regress/expected/create_table.out | 16 ++++++++++++++++
src/test/regress/sql/alter_table.sql       | 16 ++++++++++++++++
src/test/regress/sql/create_table.sql      | 14 ++++++++++++++
5 files changed, 72 insertions(+)



view thread (3+ messages)

Message-ID: <E1gJUGR-0000yt-P4@gemulon.postgresql.org>
Permalink:  ../E1gJUGR-0000yt-P4@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1gJUGR-0000yt-P4@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: Block creation of partitions with open references to its parent
  In-Reply-To: <E1gJUGR-0000yt-P4@gemulon.postgresql.org>
  References: <E1gJUGR-0000yt-P4@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