From 582ec175c9a858fb9f332b9d4adedc3f998ddf92 Mon Sep 17 00:00:00 2001 From: Jan Wieck Date: Fri, 4 Feb 2000 23:45:04 +0000 Subject: [PATCH] Small bugfix for DROP TABLE if table is self-referenced by a FOREIGN KEY constraint. Jan --- src/backend/commands/trigger.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/backend/commands/trigger.c b/src/backend/commands/trigger.c index 04c20e1827..f83fd9462c 100644 --- a/src/backend/commands/trigger.c +++ b/src/backend/commands/trigger.c @@ -7,7 +7,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/commands/trigger.c,v 1.57 2000/02/04 18:49:31 wieck Exp $ + * $Header: /cvsroot/pgsql/src/backend/commands/trigger.c,v 1.58 2000/02/04 23:45:04 wieck Exp $ * *------------------------------------------------------------------------- */ @@ -372,6 +372,13 @@ RelationRemoveTriggers(Relation rel) heap_endscan(tgscan); + /* ---------- + * Need to bump it here so the following doesn't see + * the already deleted triggers again for a self-referencing + * table. + * ---------- + */ + CommandCounterIncrement(); /* ---------- * Also drop all constraint triggers referencing this relation @@ -388,6 +395,7 @@ RelationRemoveTriggers(Relation rel) DropTrigStmt stmt; pg_trigger = (Form_pg_trigger) GETSTRUCT(tup); + refrel = heap_open(pg_trigger->tgrelid, NoLock); stmt.relname = pstrdup(RelationGetRelationName(refrel)); -- 2.40.0