diff options
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/commands/tablecmds.h | 5 | ||||
| -rw-r--r-- | src/include/nodes/parsenodes.h | 2 | ||||
| -rw-r--r-- | src/include/parser/parse_utilcmd.h | 6 | ||||
| -rw-r--r-- | src/include/tcop/utility.h | 13 |
4 files changed, 21 insertions, 5 deletions
diff --git a/src/include/commands/tablecmds.h b/src/include/commands/tablecmds.h index 2e04b824c16..c1581ad178e 100644 --- a/src/include/commands/tablecmds.h +++ b/src/include/commands/tablecmds.h @@ -21,6 +21,8 @@ #include "storage/lock.h" #include "utils/relcache.h" +struct AlterTableUtilityContext; /* avoid including tcop/utility.h here */ + extern ObjectAddress DefineRelation(CreateStmt *stmt, char relkind, Oid ownerId, ObjectAddress *typaddress, const char *queryString); @@ -29,7 +31,8 @@ extern void RemoveRelations(DropStmt *drop); extern Oid AlterTableLookupRelation(AlterTableStmt *stmt, LOCKMODE lockmode); -extern void AlterTable(Oid relid, LOCKMODE lockmode, AlterTableStmt *stmt); +extern void AlterTable(AlterTableStmt *stmt, LOCKMODE lockmode, + struct AlterTableUtilityContext *context); extern LOCKMODE AlterTableGetLockLevel(List *cmds); diff --git a/src/include/nodes/parsenodes.h b/src/include/nodes/parsenodes.h index 28d837b8fad..da0706add59 100644 --- a/src/include/nodes/parsenodes.h +++ b/src/include/nodes/parsenodes.h @@ -1802,8 +1802,6 @@ typedef enum AlterTableType AT_AlterConstraint, /* alter constraint */ AT_ValidateConstraint, /* validate constraint */ AT_ValidateConstraintRecurse, /* internal to commands/tablecmds.c */ - AT_ProcessedConstraint, /* pre-processed add constraint (local in - * parser/parse_utilcmd.c) */ AT_AddIndexConstraint, /* add constraint using existing index */ AT_DropConstraint, /* drop constraint */ AT_DropConstraintRecurse, /* internal to commands/tablecmds.c */ diff --git a/src/include/parser/parse_utilcmd.h b/src/include/parser/parse_utilcmd.h index eb73acdbd32..1a5e0b83a7a 100644 --- a/src/include/parser/parse_utilcmd.h +++ b/src/include/parser/parse_utilcmd.h @@ -20,8 +20,10 @@ struct AttrMap; /* avoid including attmap.h here */ extern List *transformCreateStmt(CreateStmt *stmt, const char *queryString); -extern List *transformAlterTableStmt(Oid relid, AlterTableStmt *stmt, - const char *queryString); +extern AlterTableStmt *transformAlterTableStmt(Oid relid, AlterTableStmt *stmt, + const char *queryString, + List **beforeStmts, + List **afterStmts); extern IndexStmt *transformIndexStmt(Oid relid, IndexStmt *stmt, const char *queryString); extern void transformRuleStmt(RuleStmt *stmt, const char *queryString, diff --git a/src/include/tcop/utility.h b/src/include/tcop/utility.h index 40551c45af2..f62bfc44173 100644 --- a/src/include/tcop/utility.h +++ b/src/include/tcop/utility.h @@ -25,6 +25,16 @@ typedef enum PROCESS_UTILITY_SUBCOMMAND /* a portion of a query */ } ProcessUtilityContext; +/* Info needed when recursing from ALTER TABLE */ +typedef struct AlterTableUtilityContext +{ + PlannedStmt *pstmt; /* PlannedStmt for outer ALTER TABLE command */ + const char *queryString; /* its query string */ + Oid relid; /* OID of ALTER's target table */ + ParamListInfo params; /* any parameters available to ALTER TABLE */ + QueryEnvironment *queryEnv; /* execution environment for ALTER TABLE */ +} AlterTableUtilityContext; + /* Hook for plugins to get control in ProcessUtility() */ typedef void (*ProcessUtility_hook_type) (PlannedStmt *pstmt, const char *queryString, ProcessUtilityContext context, @@ -42,6 +52,9 @@ extern void standard_ProcessUtility(PlannedStmt *pstmt, const char *queryString, QueryEnvironment *queryEnv, DestReceiver *dest, char *completionTag); +extern void ProcessUtilityForAlterTable(Node *stmt, + AlterTableUtilityContext *context); + extern bool UtilityReturnsTuples(Node *parsetree); extern TupleDesc UtilityTupleDescriptor(Node *parsetree); |
