Commit 582ec175 authored by Jan Wieck's avatar Jan Wieck

Small bugfix for DROP TABLE if table is self-referenced by

a FOREIGN KEY constraint.

Jan
parent 7932f86c
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * 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) ...@@ -372,6 +372,13 @@ RelationRemoveTriggers(Relation rel)
heap_endscan(tgscan); 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 * Also drop all constraint triggers referencing this relation
...@@ -388,6 +395,7 @@ RelationRemoveTriggers(Relation rel) ...@@ -388,6 +395,7 @@ RelationRemoveTriggers(Relation rel)
DropTrigStmt stmt; DropTrigStmt stmt;
pg_trigger = (Form_pg_trigger) GETSTRUCT(tup); pg_trigger = (Form_pg_trigger) GETSTRUCT(tup);
refrel = heap_open(pg_trigger->tgrelid, NoLock); refrel = heap_open(pg_trigger->tgrelid, NoLock);
stmt.relname = pstrdup(RelationGetRelationName(refrel)); stmt.relname = pstrdup(RelationGetRelationName(refrel));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment