@@ -229,12 +229,14 @@ static int MtmGcPeriod;
229229static bool MtmIgnoreTablesWithoutPk ;
230230static int MtmLockCount ;
231231
232+ static ExecutorStart_hook_type PreviousExecutorStartHook ;
232233static ExecutorFinish_hook_type PreviousExecutorFinishHook ;
233234static ProcessUtility_hook_type PreviousProcessUtilityHook ;
234235static shmem_startup_hook_type PreviousShmemStartupHook ;
235236
236237static nodemask_t lastKnownMatrix [MAX_NODES ];
237238
239+ static void MtmExecutorStart (QueryDesc * queryDesc ,int eflags );
238240static void MtmExecutorFinish (QueryDesc * queryDesc );
239241static void MtmProcessUtility (Node * parsetree ,const char * queryString ,
240242ProcessUtilityContext context ,ParamListInfo params ,
@@ -2681,6 +2683,9 @@ _PG_init(void)
26812683PreviousShmemStartupHook = shmem_startup_hook ;
26822684shmem_startup_hook = MtmShmemStartup ;
26832685
2686+ PreviousExecutorStartHook = ExecutorStart_hook ;
2687+ ExecutorStart_hook = MtmExecutorStart ;
2688+
26842689PreviousExecutorFinishHook = ExecutorFinish_hook ;
26852690ExecutorFinish_hook = MtmExecutorFinish ;
26862691
@@ -3978,12 +3983,34 @@ static void MtmProcessUtility(Node *parsetree, const char *queryString,
39783983MtmTx .snapshot = INVALID_CSN ;
39793984}
39803985
3981- if (executed && ! skipCommand )
3986+ if (executed )
39823987{
39833988MtmFinishDDLCommand ();
39843989}
39853990}
39863991
3992+ static void
3993+ MtmExecutorStart (QueryDesc * queryDesc ,int eflags )
3994+ {
3995+ bool ddl_generating_call = false;
3996+ ListCell * tlist ;
3997+
3998+ foreach (tlist ,queryDesc -> plannedstmt -> planTree -> targetlist )
3999+ {
4000+ TargetEntry * tle = (TargetEntry * )lfirst (tlist );
4001+
4002+ if (tle -> resname && strcmp (tle -> resname ,"lo_create" )== 0 )
4003+ ddl_generating_call = true;
4004+ }
4005+
4006+ if (ddl_generating_call )
4007+ MtmProcessDDLCommand (ActivePortal -> sourceText , true);
4008+
4009+ if (PreviousExecutorStartHook != NULL )
4010+ PreviousExecutorStartHook (queryDesc ,eflags );
4011+ else
4012+ standard_ExecutorStart (queryDesc ,eflags );
4013+ }
39874014
39884015static void
39894016MtmExecutorFinish (QueryDesc * queryDesc )