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: Fix SET CONSTRAINTS .. DEFERRED on partitioned tables
Date: Thu, 07 Nov 2019 17:28:28 +0000
Message-ID: <E1iSla8-0005iQ-0M@gemulon.postgresql.org> (raw)

Fix SET CONSTRAINTS .. DEFERRED on partitioned tables

SET CONSTRAINTS ... DEFERRED failed on partitioned tables, because of a
sanity check that ensures that the affected constraints have triggers.
On partitioned tables, the triggers are in the leaf partitions, not in
the partitioned relations themselves, so the sanity check fails.
Removing the sanity check solves the problem, because the code needed to
support the case is already there.

Backpatch to 11.

Note: deferred unique constraints are not affected by this bug, because
they do have triggers in the parent partitioned table.  I did not add a
test for this scenario.

Discussion: https://postgr.es/m/20191105212915.GA11324@alvherre.pgsql

Branch
------
REL_11_STABLE

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

Modified Files
--------------
src/backend/commands/trigger.c            | 10 ----------
src/test/regress/expected/foreign_key.out | 21 +++++++++++++++++++--
src/test/regress/sql/foreign_key.sql      | 20 +++++++++++++++++++-
3 files changed, 38 insertions(+), 13 deletions(-)



view thread (3+ messages)

Message-ID: <E1iSla8-0005iQ-0M@gemulon.postgresql.org>
Permalink:  ../E1iSla8-0005iQ-0M@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1iSla8-0005iQ-0M@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: Fix SET CONSTRAINTS .. DEFERRED on partitioned tables
  In-Reply-To: <E1iSla8-0005iQ-0M@gemulon.postgresql.org>
  References: <E1iSla8-0005iQ-0M@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