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

a FOREIGN KEY constraint.

Jan
This commit is contained in:
Jan Wieck 2000-02-04 23:45:04 +00:00
parent 7932f86c53
commit 582ec175c9
1 changed files with 9 additions and 1 deletions

View File

@ -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));