* ATExecCmd: dispatch a subcommand to appropriate execution routine * * NOTE: we need to use a pointer to Relation here since the relation * address may be changed by ATPExecPartSplit(). This is different * behavior from Postgres upstream. */
| 6046 | * behavior from Postgres upstream. |
| 6047 | */ |
| 6048 | static void |
| 6049 | ATExecCmd(List **wqueue, AlteredTableInfo *tab, |
| 6050 | AlterTableCmd *cmd, LOCKMODE lockmode, int cur_pass, |
| 6051 | AlterTableUtilityContext *context) |
| 6052 | { |
| 6053 | ObjectAddress address = InvalidObjectAddress; |
| 6054 | Relation rel = tab->rel; |
| 6055 | |
| 6056 | switch (cmd->subtype) |
| 6057 | { |
| 6058 | case AT_AddColumn: /* ADD COLUMN */ |
| 6059 | case AT_AddColumnToView: /* add column via CREATE OR REPLACE VIEW */ |
| 6060 | address = ATExecAddColumn(wqueue, tab, rel, &cmd, |
| 6061 | false, false, |
| 6062 | lockmode, cur_pass, context); |
| 6063 | break; |
| 6064 | case AT_AddColumnRecurse: |
| 6065 | address = ATExecAddColumn(wqueue, tab, rel, &cmd, |
| 6066 | true, false, |
| 6067 | lockmode, cur_pass, context); |
| 6068 | break; |
| 6069 | case AT_ColumnDefault: /* ALTER COLUMN DEFAULT */ |
| 6070 | address = ATExecColumnDefault(rel, cmd->name, cmd->def, lockmode); |
| 6071 | break; |
| 6072 | case AT_CookedColumnDefault: /* add a pre-cooked default */ |
| 6073 | address = ATExecCookedColumnDefault(rel, cmd->num, cmd->def); |
| 6074 | break; |
| 6075 | case AT_AddIdentity: |
| 6076 | cmd = ATParseTransformCmd(wqueue, tab, rel, cmd, false, lockmode, |
| 6077 | cur_pass, context); |
| 6078 | Assert(cmd != NULL); |
| 6079 | address = ATExecAddIdentity(rel, cmd->name, cmd->def, lockmode); |
| 6080 | break; |
| 6081 | case AT_SetIdentity: |
| 6082 | cmd = ATParseTransformCmd(wqueue, tab, rel, cmd, false, lockmode, |
| 6083 | cur_pass, context); |
| 6084 | Assert(cmd != NULL); |
| 6085 | address = ATExecSetIdentity(rel, cmd->name, cmd->def, lockmode); |
| 6086 | break; |
| 6087 | case AT_DropIdentity: |
| 6088 | address = ATExecDropIdentity(rel, cmd->name, cmd->missing_ok, lockmode); |
| 6089 | break; |
| 6090 | case AT_DropNotNull: /* ALTER COLUMN DROP NOT NULL */ |
| 6091 | address = ATExecDropNotNull(rel, cmd->name, lockmode); |
| 6092 | break; |
| 6093 | case AT_SetNotNull: /* ALTER COLUMN SET NOT NULL */ |
| 6094 | address = ATExecSetNotNull(tab, rel, cmd->name, lockmode); |
| 6095 | break; |
| 6096 | case AT_CheckNotNull: /* check column is already marked NOT NULL */ |
| 6097 | ATExecCheckNotNull(tab, rel, cmd->name, lockmode); |
| 6098 | break; |
| 6099 | case AT_DropExpression: |
| 6100 | address = ATExecDropExpression(rel, cmd->name, cmd->missing_ok, lockmode); |
| 6101 | break; |
| 6102 | case AT_SetStatistics: /* ALTER COLUMN SET STATISTICS */ |
| 6103 | address = ATExecSetStatistics(rel, cmd->name, cmd->num, cmd->def, lockmode); |
| 6104 | break; |
| 6105 | case AT_SetOptions: /* ALTER COLUMN SET ( options ) */ |
no test coverage detected