commit 7031ce2b1f79a2e03b29ac896f0a008b0621d654
Author:     Alvaro Herrera <alvherre@alvh.no-ip.org>
AuthorDate: Sat Feb 9 12:31:25 2019 -0300
CommitDate: Sat Feb 9 12:53:00 2019 -0300

    fix trigger drop

diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index 910e5deaa3f..923866b7e11 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -8024,17 +8024,21 @@ CloneFkReferencing(Relation pg_constraint, Relation parentRel,
 			while ((trigtup = systable_getnext(scan)) != NULL)
 			{
 				Form_pg_trigger	trgform = (Form_pg_trigger) GETSTRUCT(trigtup);
+				ObjectAddress	trigger;
 
 				if (trgform->tgconstrrelid != fk->conrelid)
 					continue;
 				if (trgform->tgrelid != fk->confrelid)
 					continue;
 
-				deleteDependencyRecordsForClass(TriggerRelationId,
-												HeapTupleGetOid(trigtup),
-												ConstraintRelationId,
-												DEPENDENCY_INTERNAL);
-				CatalogTupleDelete(trigrel, &trigtup->t_self);
+				deleteDependencyRecordsFor(TriggerRelationId,
+										   HeapTupleGetOid(trigtup),
+										   false);
+				/* make dependency deletion visible to performDeletion */
+				CommandCounterIncrement();
+				ObjectAddressSet(trigger, TriggerRelationId,
+								 HeapTupleGetOid(trigtup));
+				performDeletion(&trigger, DROP_RESTRICT, 0);
 			}
 
 			systable_endscan(scan);
