@@ -229,12 +229,14 @@ static int MtmGcPeriod;
229
229
static bool MtmIgnoreTablesWithoutPk ;
230
230
static int MtmLockCount ;
231
231
232
+ static ExecutorStart_hook_type PreviousExecutorStartHook ;
232
233
static ExecutorFinish_hook_type PreviousExecutorFinishHook ;
233
234
static ProcessUtility_hook_type PreviousProcessUtilityHook ;
234
235
static shmem_startup_hook_type PreviousShmemStartupHook ;
235
236
236
237
static nodemask_t lastKnownMatrix [MAX_NODES ];
237
238
239
+ static void MtmExecutorStart (QueryDesc * queryDesc , int eflags );
238
240
static void MtmExecutorFinish (QueryDesc * queryDesc );
239
241
static void MtmProcessUtility (Node * parsetree , const char * queryString ,
240
242
ProcessUtilityContext context , ParamListInfo params ,
@@ -2681,6 +2683,9 @@ _PG_init(void)
2681
2683
PreviousShmemStartupHook = shmem_startup_hook ;
2682
2684
shmem_startup_hook = MtmShmemStartup ;
2683
2685
2686
+ PreviousExecutorStartHook = ExecutorStart_hook ;
2687
+ ExecutorStart_hook = MtmExecutorStart ;
2688
+
2684
2689
PreviousExecutorFinishHook = ExecutorFinish_hook ;
2685
2690
ExecutorFinish_hook = MtmExecutorFinish ;
2686
2691
@@ -3978,12 +3983,34 @@ static void MtmProcessUtility(Node *parsetree, const char *queryString,
3978
3983
MtmTx .snapshot = INVALID_CSN ;
3979
3984
}
3980
3985
3981
- if (executed && ! skipCommand )
3986
+ if (executed )
3982
3987
{
3983
3988
MtmFinishDDLCommand ();
3984
3989
}
3985
3990
}
3986
3991
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
+ }
3987
4014
3988
4015
static void
3989
4016
MtmExecutorFinish (QueryDesc * queryDesc )
0 commit comments