@@ -71,10 +71,10 @@ ProcessUtility_hook_type ProcessUtility_hook = NULL;
7171/* local function declarations */
7272static void ProcessUtilitySlow (Node * parsetree ,
7373const char * queryString ,
74+ ProcessUtilityContext context ,
7475ParamListInfo params ,
7576DestReceiver * dest ,
76- char * completionTag ,
77- ProcessUtilityContext context );
77+ char * completionTag );
7878static void ExecDropStmt (DropStmt * stmt ,bool isTopLevel );
7979
8080
@@ -314,8 +314,9 @@ CheckRestrictedOperation(const char *cmdname)
314314 *
315315 *parsetree: the parse tree for the utility statement
316316 *queryString: original source text of command
317+ *context: identifies source of statement (toplevel client command,
318+ *non-toplevel client command, subcommand of a larger utility command)
317319 *params: parameters to use during execution
318- *isTopLevel: true if executing a "top level" (interactively issued) command
319320 *dest: where to send results
320321 *completionTag: points to a buffer of size COMPLETION_TAG_BUFSIZE
321322 *in which to store a command completion status string.
@@ -331,10 +332,10 @@ CheckRestrictedOperation(const char *cmdname)
331332void
332333ProcessUtility (Node * parsetree ,
333334const char * queryString ,
335+ ProcessUtilityContext context ,
334336ParamListInfo params ,
335337DestReceiver * dest ,
336- char * completionTag ,
337- ProcessUtilityContext context )
338+ char * completionTag )
338339{
339340Assert (queryString != NULL );/* required as of 8.4 */
340341
@@ -344,11 +345,13 @@ ProcessUtility(Node *parsetree,
344345 * call standard_ProcessUtility().
345346 */
346347if (ProcessUtility_hook )
347- (* ProcessUtility_hook ) (parsetree ,queryString ,params ,
348- dest ,completionTag ,context );
348+ (* ProcessUtility_hook ) (parsetree ,queryString ,
349+ context ,params ,
350+ dest ,completionTag );
349351else
350- standard_ProcessUtility (parsetree ,queryString ,params ,
351- dest ,completionTag ,context );
352+ standard_ProcessUtility (parsetree ,queryString ,
353+ context ,params ,
354+ dest ,completionTag );
352355}
353356
354357/*
@@ -365,10 +368,10 @@ ProcessUtility(Node *parsetree,
365368void
366369standard_ProcessUtility (Node * parsetree ,
367370const char * queryString ,
371+ ProcessUtilityContext context ,
368372ParamListInfo params ,
369373DestReceiver * dest ,
370- char * completionTag ,
371- ProcessUtilityContext context )
374+ char * completionTag )
372375{
373376bool isTopLevel = (context == PROCESS_UTILITY_TOPLEVEL );
374377
@@ -817,8 +820,9 @@ standard_ProcessUtility(Node *parsetree,
817820DropStmt * stmt = (DropStmt * )parsetree ;
818821
819822if (EventTriggerSupportsObjectType (stmt -> removeType ))
820- ProcessUtilitySlow (parsetree ,queryString ,params ,
821- dest ,completionTag ,context );
823+ ProcessUtilitySlow (parsetree ,queryString ,
824+ context ,params ,
825+ dest ,completionTag );
822826else
823827ExecDropStmt (stmt ,isTopLevel );
824828}
@@ -829,8 +833,9 @@ standard_ProcessUtility(Node *parsetree,
829833RenameStmt * stmt = (RenameStmt * )parsetree ;
830834
831835if (EventTriggerSupportsObjectType (stmt -> renameType ))
832- ProcessUtilitySlow (parsetree ,queryString ,params ,
833- dest ,completionTag ,context );
836+ ProcessUtilitySlow (parsetree ,queryString ,
837+ context ,params ,
838+ dest ,completionTag );
834839else
835840ExecRenameStmt (stmt );
836841}
@@ -841,8 +846,9 @@ standard_ProcessUtility(Node *parsetree,
841846AlterObjectSchemaStmt * stmt = (AlterObjectSchemaStmt * )parsetree ;
842847
843848if (EventTriggerSupportsObjectType (stmt -> objectType ))
844- ProcessUtilitySlow (parsetree ,queryString ,params ,
845- dest ,completionTag ,context );
849+ ProcessUtilitySlow (parsetree ,queryString ,
850+ context ,params ,
851+ dest ,completionTag );
846852else
847853ExecAlterObjectSchemaStmt (stmt );
848854}
@@ -853,17 +859,19 @@ standard_ProcessUtility(Node *parsetree,
853859AlterOwnerStmt * stmt = (AlterOwnerStmt * )parsetree ;
854860
855861if (EventTriggerSupportsObjectType (stmt -> objectType ))
856- ProcessUtilitySlow (parsetree ,queryString ,params ,
857- dest ,completionTag ,context );
862+ ProcessUtilitySlow (parsetree ,queryString ,
863+ context ,params ,
864+ dest ,completionTag );
858865else
859866ExecAlterOwnerStmt (stmt );
860867}
861868break ;
862869
863870default :
864871/* All other statement types have event trigger support */
865- ProcessUtilitySlow (parsetree ,queryString ,params ,
866- dest ,completionTag ,context );
872+ ProcessUtilitySlow (parsetree ,queryString ,
873+ context ,params ,
874+ dest ,completionTag );
867875break ;
868876}
869877}
@@ -876,10 +884,10 @@ standard_ProcessUtility(Node *parsetree,
876884static void
877885ProcessUtilitySlow (Node * parsetree ,
878886const char * queryString ,
887+ ProcessUtilityContext context ,
879888ParamListInfo params ,
880889DestReceiver * dest ,
881- char * completionTag ,
882- ProcessUtilityContext context )
890+ char * completionTag )
883891{
884892bool isTopLevel = (context == PROCESS_UTILITY_TOPLEVEL );
885893bool isCompleteQuery = (context <=PROCESS_UTILITY_QUERY );
@@ -966,10 +974,10 @@ ProcessUtilitySlow(Node *parsetree,
966974/* Recurse for anything else */
967975ProcessUtility (stmt ,
968976queryString ,
977+ PROCESS_UTILITY_SUBCOMMAND ,
969978params ,
970979None_Receiver ,
971- NULL ,
972- PROCESS_UTILITY_GENERATED );
980+ NULL );
973981}
974982
975983/* Need CCI between commands */
@@ -1017,10 +1025,10 @@ ProcessUtilitySlow(Node *parsetree,
10171025/* Recurse for anything else */
10181026ProcessUtility (stmt ,
10191027queryString ,
1028+ PROCESS_UTILITY_SUBCOMMAND ,
10201029params ,
10211030None_Receiver ,
1022- NULL ,
1023- PROCESS_UTILITY_GENERATED );
1031+ NULL );
10241032}
10251033
10261034/* Need CCI between commands */