@@ -71,10 +71,10 @@ ProcessUtility_hook_type ProcessUtility_hook = NULL;
7171/* local function declarations */
7272static void ProcessUtilitySlow (Node * parsetree ,
7373 const char * queryString ,
74+ ProcessUtilityContext context ,
7475 ParamListInfo params ,
7576 DestReceiver * 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 ,
333334 const char * queryString ,
335+ ProcessUtilityContext context ,
334336 ParamListInfo params ,
335337 DestReceiver * dest ,
336- char * completionTag ,
337- ProcessUtilityContext context )
338+ char * completionTag )
338339{
339340 Assert (queryString != NULL ); /* required as of 8.4 */
340341
@@ -344,11 +345,13 @@ ProcessUtility(Node *parsetree,
344345 * call standard_ProcessUtility().
345346 */
346347 if (ProcessUtility_hook )
347- (* ProcessUtility_hook ) (parsetree , queryString , params ,
348- dest , completionTag , context );
348+ (* ProcessUtility_hook ) (parsetree , queryString ,
349+ context , params ,
350+ dest , completionTag );
349351 else
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 ,
367370 const char * queryString ,
371+ ProcessUtilityContext context ,
368372 ParamListInfo params ,
369373 DestReceiver * dest ,
370- char * completionTag ,
371- ProcessUtilityContext context )
374+ char * completionTag )
372375{
373376 bool isTopLevel = (context == PROCESS_UTILITY_TOPLEVEL );
374377
@@ -817,8 +820,9 @@ standard_ProcessUtility(Node *parsetree,
817820 DropStmt * stmt = (DropStmt * ) parsetree ;
818821
819822 if (EventTriggerSupportsObjectType (stmt -> removeType ))
820- ProcessUtilitySlow (parsetree , queryString , params ,
821- dest , completionTag , context );
823+ ProcessUtilitySlow (parsetree , queryString ,
824+ context , params ,
825+ dest , completionTag );
822826 else
823827 ExecDropStmt (stmt , isTopLevel );
824828 }
@@ -829,8 +833,9 @@ standard_ProcessUtility(Node *parsetree,
829833 RenameStmt * stmt = (RenameStmt * ) parsetree ;
830834
831835 if (EventTriggerSupportsObjectType (stmt -> renameType ))
832- ProcessUtilitySlow (parsetree , queryString , params ,
833- dest , completionTag , context );
836+ ProcessUtilitySlow (parsetree , queryString ,
837+ context , params ,
838+ dest , completionTag );
834839 else
835840 ExecRenameStmt (stmt );
836841 }
@@ -841,8 +846,9 @@ standard_ProcessUtility(Node *parsetree,
841846 AlterObjectSchemaStmt * stmt = (AlterObjectSchemaStmt * ) parsetree ;
842847
843848 if (EventTriggerSupportsObjectType (stmt -> objectType ))
844- ProcessUtilitySlow (parsetree , queryString , params ,
845- dest , completionTag , context );
849+ ProcessUtilitySlow (parsetree , queryString ,
850+ context , params ,
851+ dest , completionTag );
846852 else
847853 ExecAlterObjectSchemaStmt (stmt );
848854 }
@@ -853,17 +859,19 @@ standard_ProcessUtility(Node *parsetree,
853859 AlterOwnerStmt * stmt = (AlterOwnerStmt * ) parsetree ;
854860
855861 if (EventTriggerSupportsObjectType (stmt -> objectType ))
856- ProcessUtilitySlow (parsetree , queryString , params ,
857- dest , completionTag , context );
862+ ProcessUtilitySlow (parsetree , queryString ,
863+ context , params ,
864+ dest , completionTag );
858865 else
859866 ExecAlterOwnerStmt (stmt );
860867 }
861868 break ;
862869
863870 default :
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 );
867875 break ;
868876 }
869877}
@@ -876,10 +884,10 @@ standard_ProcessUtility(Node *parsetree,
876884static void
877885ProcessUtilitySlow (Node * parsetree ,
878886 const char * queryString ,
887+ ProcessUtilityContext context ,
879888 ParamListInfo params ,
880889 DestReceiver * dest ,
881- char * completionTag ,
882- ProcessUtilityContext context )
890+ char * completionTag )
883891{
884892 bool isTopLevel = (context == PROCESS_UTILITY_TOPLEVEL );
885893 bool isCompleteQuery = (context <= PROCESS_UTILITY_QUERY );
@@ -966,10 +974,10 @@ ProcessUtilitySlow(Node *parsetree,
966974 /* Recurse for anything else */
967975 ProcessUtility (stmt ,
968976 queryString ,
977+ PROCESS_UTILITY_SUBCOMMAND ,
969978 params ,
970979 None_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 */
10181026 ProcessUtility (stmt ,
10191027 queryString ,
1028+ PROCESS_UTILITY_SUBCOMMAND ,
10201029 params ,
10211030 None_Receiver ,
1022- NULL ,
1023- PROCESS_UTILITY_GENERATED );
1031+ NULL );
10241032 }
10251033
10261034 /* Need CCI between commands */
0 commit comments