@@ -816,7 +816,7 @@ RemoveRelations(DropStmt *drop)
816
816
add_exact_object_address (& obj , objects );
817
817
}
818
818
819
- performMultipleDeletions (objects , drop -> behavior );
819
+ performMultipleDeletions (objects , drop -> behavior , 0 );
820
820
821
821
free_object_addresses (objects );
822
822
}
@@ -4803,8 +4803,13 @@ ATExecColumnDefault(Relation rel, const char *colName,
4803
4803
* Remove any old default for the column. We use RESTRICT here for
4804
4804
* safety, but at present we do not expect anything to depend on the
4805
4805
* default.
4806
+ *
4807
+ * We treat removing the existing default as an internal operation when
4808
+ * it is preparatory to adding a new default, but as a user-initiated
4809
+ * operation when the user asked for a drop.
4806
4810
*/
4807
- RemoveAttrDefault (RelationGetRelid (rel ), attnum , DROP_RESTRICT , false);
4811
+ RemoveAttrDefault (RelationGetRelid (rel ), attnum , DROP_RESTRICT , false,
4812
+ newDefault == NULL ? false : true);
4808
4813
4809
4814
if (newDefault )
4810
4815
{
@@ -5217,7 +5222,7 @@ ATExecDropColumn(List **wqueue, Relation rel, const char *colName,
5217
5222
object .objectId = RelationGetRelid (rel );
5218
5223
object .objectSubId = attnum ;
5219
5224
5220
- performDeletion (& object , behavior );
5225
+ performDeletion (& object , behavior , 0 );
5221
5226
5222
5227
/*
5223
5228
* If we dropped the OID column, must adjust pg_class.relhasoids and tell
@@ -6731,7 +6736,7 @@ ATExecDropConstraint(Relation rel, const char *constrName,
6731
6736
conobj .objectId = HeapTupleGetOid (tuple );
6732
6737
conobj .objectSubId = 0 ;
6733
6738
6734
- performDeletion (& conobj , behavior );
6739
+ performDeletion (& conobj , behavior , 0 );
6735
6740
6736
6741
found = true;
6737
6742
@@ -7453,7 +7458,8 @@ ATExecAlterColumnType(AlteredTableInfo *tab, Relation rel,
7453
7458
* We use RESTRICT here for safety, but at present we do not expect
7454
7459
* anything to depend on the default.
7455
7460
*/
7456
- RemoveAttrDefault (RelationGetRelid (rel ), attnum , DROP_RESTRICT , true);
7461
+ RemoveAttrDefault (RelationGetRelid (rel ), attnum , DROP_RESTRICT , true,
7462
+ true);
7457
7463
7458
7464
StoreAttrDefault (rel , attnum , defaultexpr );
7459
7465
}
@@ -7598,15 +7604,15 @@ ATPostAlterTypeCleanup(List **wqueue, AlteredTableInfo *tab, LOCKMODE lockmode)
7598
7604
obj .classId = ConstraintRelationId ;
7599
7605
obj .objectId = lfirst_oid (oid_item );
7600
7606
obj .objectSubId = 0 ;
7601
- performDeletion (& obj , DROP_RESTRICT );
7607
+ performDeletion (& obj , DROP_RESTRICT , PERFORM_DELETION_INTERNAL );
7602
7608
}
7603
7609
7604
7610
foreach (oid_item , tab -> changedIndexOids )
7605
7611
{
7606
7612
obj .classId = RelationRelationId ;
7607
7613
obj .objectId = lfirst_oid (oid_item );
7608
7614
obj .objectSubId = 0 ;
7609
- performDeletion (& obj , DROP_RESTRICT );
7615
+ performDeletion (& obj , DROP_RESTRICT , PERFORM_DELETION_INTERNAL );
7610
7616
}
7611
7617
7612
7618
/*
@@ -9764,7 +9770,14 @@ PreCommit_on_commit_actions(void)
9764
9770
object .classId = RelationRelationId ;
9765
9771
object .objectId = oc -> relid ;
9766
9772
object .objectSubId = 0 ;
9767
- performDeletion (& object , DROP_CASCADE );
9773
+
9774
+ /*
9775
+ * Since this is an automatic drop, rather than one
9776
+ * directly initiated by the user, we pass the
9777
+ * PERFORM_DELETION_INTERNAL flag.
9778
+ */
9779
+ performDeletion (& object ,
9780
+ DROP_CASCADE , PERFORM_DELETION_INTERNAL );
9768
9781
9769
9782
/*
9770
9783
* Note that table deletion will call
0 commit comments