@@ -755,24 +755,25 @@ pathman_relcache_hook(Datum arg, Oid relid)
755755 */
756756void
757757#if PG_VERSION_NUM >= 100000
758- pathman_process_utility_hook (PlannedStmt * pstmt ,
758+ pathman_process_utility_hook (PlannedStmt * first_arg ,
759759 const char * queryString ,
760760 ProcessUtilityContext context ,
761761 ParamListInfo params ,
762762 QueryEnvironment * queryEnv ,
763763 DestReceiver * dest , char * completionTag )
764764{
765- Node * parsetree = pstmt -> utilityStmt ;
766- int stmt_location = pstmt -> stmt_location ,
767- stmt_len = pstmt -> stmt_len ;
765+ Node * parsetree = first_arg -> utilityStmt ;
766+ int stmt_location = first_arg -> stmt_location ,
767+ stmt_len = first_arg -> stmt_len ;
768768#else
769- pathman_process_utility_hook (Node * parsetree ,
769+ pathman_process_utility_hook (Node * first_arg ,
770770 const char * queryString ,
771771 ProcessUtilityContext context ,
772772 ParamListInfo params ,
773773 DestReceiver * dest ,
774774 char * completionTag )
775775{
776+ Node * parsetree = first_arg ;
776777 int stmt_location = -1 ,
777778 stmt_len = 0 ;
778779#endif
@@ -825,27 +826,9 @@ pathman_process_utility_hook(Node *parsetree,
825826 }
826827 }
827828
828- #if PG_VERSION_NUM >= 100000
829- /* Call hooks set by other extensions if needed */
830- if (process_utility_hook_next )
831- process_utility_hook_next (pstmt , queryString ,
832- context , params , queryEnv ,
833- dest , completionTag );
834- /* Else call internal implementation */
835- else
836- standard_ProcessUtility (pstmt , queryString ,
837- context , params , queryEnv ,
838- dest , completionTag );
839- #else
840- /* Call hooks set by other extensions if needed */
841- if (process_utility_hook_next )
842- process_utility_hook_next (parsetree , queryString ,
843- context , params ,
844- dest , completionTag );
845- /* Else call internal implementation */
846- else
847- standard_ProcessUtility (parsetree , queryString ,
848- context , params ,
849- dest , completionTag );
850- #endif
829+ /* 'first_arg' is PlannedStmt in pg10 or Node parsetree in pg9.6 and lower */
830+ call_process_utility_compat (
831+ (process_utility_hook_next ) ? process_utility_hook_next :
832+ standard_ProcessUtility ,
833+ first_arg , queryString , context , params , queryEnv , dest , completionTag );
851834}
0 commit comments