pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Create action triggers when partitions are detached
Date: Mon, 21 Jan 2019 23:10:44 +0000
Message-ID: <E1gliiK-0004GQ-An@gemulon.postgresql.org> (raw)

Create action triggers when partitions are detached

Detaching a partition from a partitioned table that's constrained by
foreign keys requires additional action triggers on the referenced side;
otherwise, DELETE/UPDATE actions there fail to notice rows in the table
that was partition, and so are incorrectly allowed through.  With this
commit, those triggers are now created.  Conversely, when a table that
has a foreign key is attached as a partition to a table that also has
the same foreign key, those action triggers are no longer needed, so we
remove them.

Add a minimal test case verifying (part of) this.

Authors: Amit Langote, Álvaro Herrera
Discussion: https://postgr.es/m/f2b8ead5-4131-d5a8-8016-2ea0a31250af@lab.ntt.co.jp

Branch
------
REL_11_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/123cc697a8eb0827e82ceea3f6da55b2f05eb422

Modified Files
--------------
src/backend/commands/tablecmds.c          | 71 ++++++++++++++++++++++++++++++-
src/test/regress/expected/foreign_key.out | 28 +++++++++++-
src/test/regress/sql/foreign_key.sql      | 19 ++++++++-
3 files changed, 113 insertions(+), 5 deletions(-)



view thread (2+ messages)

Message-ID: <E1gliiK-0004GQ-An@gemulon.postgresql.org>
Permalink:  ../E1gliiK-0004GQ-An@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1gliiK-0004GQ-An@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: alvherre@alvh.no-ip.org
  Subject: Re: pgsql: Create action triggers when partitions are detached
  In-Reply-To: <E1gliiK-0004GQ-An@gemulon.postgresql.org>
  References: <E1gliiK-0004GQ-An@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