* For most subcommand types, phases 2 and 3 do no explicit recursion,
* since phase 1 already does it. However, for certain subcommand types
* it is only possible to determine how to recurse at phase 2 time; for
- * those cases, phase 1 sets the cmd->recurse flag (or, in some older coding,
- * changes the command subtype of a "Recurse" variant XXX to be cleaned up.)
+ * those cases, phase 1 sets the cmd->recurse flag.
*
* Thanks to the magic of MVCC, an error anywhere along the way rolls back
* the whole operation; we don't have to do anything special to clean up.
break;
case AT_AddConstraint:
- case AT_AddConstraintRecurse: /* becomes AT_AddConstraint */
case AT_ReAddConstraint: /* becomes AT_AddConstraint */
case AT_ReAddDomainConstraint: /* becomes AT_AddConstraint */
if (IsA(cmd->def, Constraint))
/* Recursion occurs during execution phase */
/* No command-specific prep needed except saving recurse flag */
if (recurse)
- cmd->subtype = AT_AddConstraintRecurse;
+ cmd->recurse = true;
pass = AT_PASS_ADD_CONSTR;
break;
case AT_AddIndexConstraint: /* ADD CONSTRAINT USING INDEX */
/* Other recursion occurs during execution phase */
/* No command-specific prep needed except saving recurse flag */
if (recurse)
- cmd->subtype = AT_DropConstraintRecurse;
+ cmd->recurse = true;
pass = AT_PASS_DROP;
break;
case AT_AlterColumnType: /* ALTER COLUMN TYPE */
/* Recursion occurs during execution phase */
/* No command-specific prep needed except saving recurse flag */
if (recurse)
- cmd->subtype = AT_ValidateConstraintRecurse;
+ cmd->recurse = true;
pass = AT_PASS_MISC;
break;
case AT_ReplicaIdentity: /* REPLICA IDENTITY ... */
case AT_AddColumn: /* ADD COLUMN */
case AT_AddColumnToView: /* add column via CREATE OR REPLACE VIEW */
address = ATExecAddColumn(wqueue, tab, rel, &cmd,
- false, false,
- lockmode, cur_pass, context);
- break;
- case AT_AddColumnRecurse:
- address = ATExecAddColumn(wqueue, tab, rel, &cmd,
- true, false,
+ cmd->recurse, false,
lockmode, cur_pass, context);
break;
case AT_ColumnDefault: /* ALTER COLUMN DEFAULT */
break;
case AT_DropColumn: /* DROP COLUMN */
address = ATExecDropColumn(wqueue, rel, cmd->name,
- cmd->behavior, false, false,
- cmd->missing_ok, lockmode,
- NULL);
- break;
- case AT_DropColumnRecurse: /* DROP COLUMN with recursion */
- address = ATExecDropColumn(wqueue, rel, cmd->name,
- cmd->behavior, true, false,
+ cmd->behavior, cmd->recurse, false,
cmd->missing_ok, lockmode,
NULL);
break;
/* Transform the command only during initial examination */
if (cur_pass == AT_PASS_ADD_CONSTR)
cmd = ATParseTransformCmd(wqueue, tab, rel, cmd,
- false, lockmode,
+ cmd->recurse, lockmode,
cur_pass, context);
/* Depending on constraint type, might be no more work to do now */
if (cmd != NULL)
address =
ATExecAddConstraint(wqueue, tab, rel,
(Constraint *) cmd->def,
- false, false, lockmode);
- break;
- case AT_AddConstraintRecurse: /* ADD CONSTRAINT with recursion */
- /* Transform the command only during initial examination */
- if (cur_pass == AT_PASS_ADD_CONSTR)
- cmd = ATParseTransformCmd(wqueue, tab, rel, cmd,
- true, lockmode,
- cur_pass, context);
- /* Depending on constraint type, might be no more work to do now */
- if (cmd != NULL)
- address =
- ATExecAddConstraint(wqueue, tab, rel,
- (Constraint *) cmd->def,
- true, false, lockmode);
+ cmd->recurse, false, lockmode);
break;
case AT_ReAddConstraint: /* Re-add pre-existing check constraint */
address =
address = ATExecAlterConstraint(rel, cmd, false, false, lockmode);
break;
case AT_ValidateConstraint: /* VALIDATE CONSTRAINT */
- address = ATExecValidateConstraint(wqueue, rel, cmd->name, false,
- false, lockmode);
- break;
- case AT_ValidateConstraintRecurse: /* VALIDATE CONSTRAINT with
- * recursion */
- address = ATExecValidateConstraint(wqueue, rel, cmd->name, true,
+ address = ATExecValidateConstraint(wqueue, rel, cmd->name, cmd->recurse,
false, lockmode);
break;
case AT_DropConstraint: /* DROP CONSTRAINT */
ATExecDropConstraint(rel, cmd->name, cmd->behavior,
- false, false,
- cmd->missing_ok, lockmode);
- break;
- case AT_DropConstraintRecurse: /* DROP CONSTRAINT with recursion */
- ATExecDropConstraint(rel, cmd->name, cmd->behavior,
- true, false,
+ cmd->recurse, false,
cmd->missing_ok, lockmode);
break;
case AT_AlterColumnType: /* ALTER COLUMN TYPE */
case AT_AddConstraint:
/* Recursion occurs during execution phase */
if (recurse)
- cmd2->subtype = AT_AddConstraintRecurse;
+ cmd2->recurse = true;
switch (castNode(Constraint, cmd2->def)->contype)
{
case CONSTR_PRIMARY:
switch (cmdtype)
{
case AT_AddColumn:
- case AT_AddColumnRecurse:
case AT_AddColumnToView:
return "ADD COLUMN";
case AT_ColumnDefault:
case AT_SetCompression:
return "ALTER COLUMN ... SET COMPRESSION";
case AT_DropColumn:
- case AT_DropColumnRecurse:
return "DROP COLUMN";
case AT_AddIndex:
case AT_ReAddIndex:
return NULL; /* not real grammar */
case AT_AddConstraint:
- case AT_AddConstraintRecurse:
case AT_ReAddConstraint:
case AT_ReAddDomainConstraint:
case AT_AddIndexConstraint:
case AT_AlterConstraint:
return "ALTER CONSTRAINT";
case AT_ValidateConstraint:
- case AT_ValidateConstraintRecurse:
return "VALIDATE CONSTRAINT";
case AT_DropConstraint:
- case AT_DropConstraintRecurse:
return "DROP CONSTRAINT";
case AT_ReAddComment:
return NULL; /* not real grammar */
ATTypedTableRecursion(wqueue, rel, cmd, lockmode, context);
if (recurse && !is_view)
- cmd->subtype = AT_AddColumnRecurse;
+ cmd->recurse = true;
}
/*
ATTypedTableRecursion(wqueue, rel, cmd, lockmode, context);
if (recurse)
- cmd->subtype = AT_DropColumnRecurse;
+ cmd->recurse = true;
}
/*
typedef enum AlterTableType
{
AT_AddColumn, /* add column */
- AT_AddColumnRecurse, /* internal to commands/tablecmds.c */
AT_AddColumnToView, /* implicitly via CREATE OR REPLACE VIEW */
AT_ColumnDefault, /* alter column default */
AT_CookedColumnDefault, /* add a pre-cooked column default */
AT_SetStorage, /* alter column set storage */
AT_SetCompression, /* alter column set compression */
AT_DropColumn, /* drop column */
- AT_DropColumnRecurse, /* internal to commands/tablecmds.c */
AT_AddIndex, /* add index */
AT_ReAddIndex, /* internal to commands/tablecmds.c */
AT_AddConstraint, /* add constraint */
- AT_AddConstraintRecurse, /* internal to commands/tablecmds.c */
AT_ReAddConstraint, /* internal to commands/tablecmds.c */
AT_ReAddDomainConstraint, /* internal to commands/tablecmds.c */
AT_AlterConstraint, /* alter constraint */
AT_ValidateConstraint, /* validate constraint */
- AT_ValidateConstraintRecurse, /* internal to commands/tablecmds.c */
AT_AddIndexConstraint, /* add constraint using existing index */
AT_DropConstraint, /* drop constraint */
- AT_DropConstraintRecurse, /* internal to commands/tablecmds.c */
AT_ReAddComment, /* internal to commands/tablecmds.c */
AT_AlterColumnType, /* alter column type */
AT_AlterColumnGenericOptions, /* alter column OPTIONS (...) */