mirror of
https://github.com/postgres/postgres.git
synced 2025-07-31 22:04:40 +03:00
Small bugfix for DROP TABLE if table is self-referenced by
a FOREIGN KEY constraint. Jan
This commit is contained in:
@ -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)
|
|||||||
|
|
||||||
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)
|
|||||||
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));
|
||||||
|
Reference in New Issue
Block a user