pgsql: Check for pending trigger events on far end when dropping an FK

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Check for pending trigger events on far end when dropping an FK
Date: 2016-11-25 18:45:17
Message-ID: E1cALUr-0000m9-0F@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Check for pending trigger events on far end when dropping an FK constraint.

When dropping a foreign key constraint with ALTER TABLE DROP CONSTRAINT,
we refuse the drop if there are any pending trigger events on the named
table; this ensures that we won't remove the pg_trigger row that will be
consulted by those events. But we should make the same check for the
referenced relation, else we might remove a due-to-be-referenced pg_trigger
row for that relation too, resulting in "could not find trigger NNN" or
"relation NNN has no triggers" errors at commit. Per bug #14431 from
Benjie Gillam. Back-patch to all supported branches.

Report: <20161124114911(dot)6530(dot)31200(at)wrigleys(dot)postgresql(dot)org>

Branch
------
REL9_5_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/6cbe84c826b51a159825e9843184c7b4a740e4ae

Modified Files
--------------
src/backend/commands/tablecmds.c | 18 ++++++++++++++++++
src/test/regress/expected/foreign_key.out | 13 +++++++++++++
src/test/regress/sql/foreign_key.sql | 13 +++++++++++++
3 files changed, 44 insertions(+)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2016-11-25 21:20:41 pgsql: Mark a query's topmost Paths parallel-unsafe if they will have i
Previous Message Tom Lane 2016-11-25 18:45:16 pgsql: Check for pending trigger events on far end when dropping an FK