Skip to content

Commit 582ec17

Browse files
Jan WieckJan Wieck
authored andcommitted
Small bugfix for DROP TABLE if table is self-referenced by
a FOREIGN KEY constraint. Jan
1 parent 7932f86 commit 582ec17

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/backend/commands/trigger.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/commands/trigger.c,v 1.57 2000/02/04 18:49:31 wieck Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/commands/trigger.c,v 1.58 2000/02/04 23:45:04 wieck Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -372,6 +372,13 @@ RelationRemoveTriggers(Relation rel)
372372

373373
heap_endscan(tgscan);
374374

375+
/* ----------
376+
* Need to bump it here so the following doesn't see
377+
* the already deleted triggers again for a self-referencing
378+
* table.
379+
* ----------
380+
*/
381+
CommandCounterIncrement();
375382

376383
/* ----------
377384
* Also drop all constraint triggers referencing this relation
@@ -388,6 +395,7 @@ RelationRemoveTriggers(Relation rel)
388395
DropTrigStmt stmt;
389396

390397
pg_trigger = (Form_pg_trigger) GETSTRUCT(tup);
398+
391399
refrel = heap_open(pg_trigger->tgrelid, NoLock);
392400

393401
stmt.relname = pstrdup(RelationGetRelationName(refrel));

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy