@@ -542,8 +542,7 @@ static void GetForeignKeyCheckTriggers(Relation trigrel,
542
542
Oid *insertTriggerOid,
543
543
Oid *updateTriggerOid);
544
544
static void ATExecDropConstraint(Relation rel, const char *constrName,
545
- DropBehavior behavior,
546
- bool recurse, bool recursing,
545
+ DropBehavior behavior, bool recurse,
547
546
bool missing_ok, LOCKMODE lockmode);
548
547
static ObjectAddress dropconstraint_internal(Relation rel,
549
548
HeapTuple constraintTup, DropBehavior behavior,
@@ -5236,7 +5235,7 @@ ATExecCmd(List **wqueue, AlteredTableInfo *tab,
5236
5235
break;
5237
5236
case AT_DropConstraint: /* DROP CONSTRAINT */
5238
5237
ATExecDropConstraint(rel, cmd->name, cmd->behavior,
5239
- cmd->recurse, false,
5238
+ cmd->recurse,
5240
5239
cmd->missing_ok, lockmode);
5241
5240
break;
5242
5241
case AT_AlterColumnType: /* ALTER COLUMN TYPE */
@@ -12263,8 +12262,7 @@ createForeignKeyCheckTriggers(Oid myRelOid, Oid refRelOid,
12263
12262
*/
12264
12263
static void
12265
12264
ATExecDropConstraint(Relation rel, const char *constrName,
12266
- DropBehavior behavior,
12267
- bool recurse, bool recursing,
12265
+ DropBehavior behavior, bool recurse,
12268
12266
bool missing_ok, LOCKMODE lockmode)
12269
12267
{
12270
12268
Relation conrel;
@@ -12273,10 +12271,6 @@ ATExecDropConstraint(Relation rel, const char *constrName,
12273
12271
HeapTuple tuple;
12274
12272
bool found = false;
12275
12273
12276
- /* At top level, permission check was done in ATPrepCmd, else do it */
12277
- if (recursing)
12278
- ATSimplePermissions(AT_DropConstraint, rel, ATT_TABLE | ATT_FOREIGN_TABLE);
12279
-
12280
12274
conrel = table_open(ConstraintRelationId, RowExclusiveLock);
12281
12275
12282
12276
/*
@@ -12302,7 +12296,7 @@ ATExecDropConstraint(Relation rel, const char *constrName,
12302
12296
{
12303
12297
List *readyRels = NIL;
12304
12298
12305
- dropconstraint_internal(rel, tuple, behavior, recurse, recursing ,
12299
+ dropconstraint_internal(rel, tuple, behavior, recurse, false ,
12306
12300
missing_ok, &readyRels, lockmode);
12307
12301
found = true;
12308
12302
}
@@ -12353,6 +12347,10 @@ dropconstraint_internal(Relation rel, HeapTuple constraintTup, DropBehavior beha
12353
12347
return InvalidObjectAddress;
12354
12348
*readyRels = lappend_oid(*readyRels, RelationGetRelid(rel));
12355
12349
12350
+ /* At top level, permission check was done in ATPrepCmd, else do it */
12351
+ if (recursing)
12352
+ ATSimplePermissions(AT_DropConstraint, rel, ATT_TABLE | ATT_FOREIGN_TABLE);
12353
+
12356
12354
conrel = table_open(ConstraintRelationId, RowExclusiveLock);
12357
12355
12358
12356
con = (Form_pg_constraint) GETSTRUCT(constraintTup);
0 commit comments