@@ -3598,6 +3598,7 @@ typedef struct MtmGucHashEntry
3598
3598
} MtmGucHashEntry ;
3599
3599
3600
3600
static HTAB * MtmGucHash = NULL ;
3601
+ static List * MtmGucList = NULL ;
3601
3602
3602
3603
static void MtmGucHashInit (void )
3603
3604
{
@@ -3618,7 +3619,6 @@ static void MtmGucSet(VariableSetStmt *stmt, const char *queryStr)
3618
3619
MemoryContext oldcontext ;
3619
3620
MtmGucHashEntry * hentry ;
3620
3621
bool found ;
3621
- char * key ;
3622
3622
3623
3623
if (!MtmGucHash )
3624
3624
MtmGucHashInit ();
@@ -3628,54 +3628,30 @@ static void MtmGucSet(VariableSetStmt *stmt, const char *queryStr)
3628
3628
switch (stmt -> kind )
3629
3629
{
3630
3630
case VAR_SET_VALUE :
3631
- case VAR_SET_DEFAULT :
3632
- case VAR_SET_CURRENT :
3633
- {
3634
- char * value ;
3635
-
3636
- key = pstrdup (stmt -> name );
3637
- hash_search (MtmGucHash , key , HASH_FIND , & found );
3638
- value = ExtractSetVariableArgs (stmt );
3639
-
3640
- fprintf (stderr , ":MtmGucSet: %s -> %s\n" , key , value );
3641
-
3642
- if (value )
3643
- {
3644
- hentry = (MtmGucHashEntry * ) hash_search (MtmGucHash , key ,
3645
- HASH_ENTER , & found );
3646
-
3647
- // if (found)
3648
- // pfree(hentry->value);
3631
+ hentry = (MtmGucHashEntry * ) hash_search (MtmGucHash , stmt -> name ,
3632
+ HASH_ENTER , & found );
3633
+ if (found )
3634
+ pfree (hentry -> value );
3635
+ hentry -> value = ExtractSetVariableArgs (stmt );
3636
+ break ;
3649
3637
3650
- hentry -> value = palloc (strlen (value ) + 1 );
3651
- strcpy (hentry -> value , value );
3652
- }
3653
- else if (found )
3654
- {
3655
- /* That was SET TO DEFAULT and we already had some value */
3656
- hash_search (MtmGucHash , key , HASH_REMOVE , NULL );
3657
- }
3658
- }
3638
+ case VAR_SET_DEFAULT :
3639
+ hash_search (MtmGucHash , stmt -> name , HASH_REMOVE , NULL );
3659
3640
break ;
3660
3641
3661
3642
case VAR_RESET :
3662
- {
3663
- if (strcmp (stmt -> name , "session_authorization" ) == 0 )
3664
- {
3665
- hash_search (MtmGucHash , "role" , HASH_REMOVE , NULL );
3666
- }
3667
- key = pstrdup (stmt -> name );
3668
- hash_search (MtmGucHash , key , HASH_REMOVE , NULL );
3669
- }
3643
+ if (strcmp (stmt -> name , "session_authorization" ) == 0 )
3644
+ hash_search (MtmGucHash , "role" , HASH_REMOVE , NULL );
3645
+ hash_search (MtmGucHash , stmt -> name , HASH_REMOVE , NULL );
3670
3646
break ;
3671
3647
3672
3648
case VAR_RESET_ALL :
3673
- {
3674
- hash_destroy (MtmGucHash );
3675
- MtmGucHashInit ();
3676
- }
3649
+ /* XXX: shouldn't we keep auth/role here? */
3650
+ hash_destroy (MtmGucHash );
3651
+ MtmGucHashInit ();
3677
3652
break ;
3678
3653
3654
+ case VAR_SET_CURRENT :
3679
3655
case VAR_SET_MULTI :
3680
3656
break ;
3681
3657
}
@@ -4000,10 +3976,19 @@ MtmExecutorStart(QueryDesc *queryDesc, int eflags)
4000
3976
TargetEntry * tle = (TargetEntry * ) lfirst (tlist );
4001
3977
4002
3978
if (tle -> resname && strcmp (tle -> resname , "lo_create" ) == 0 )
3979
+ {
4003
3980
ddl_generating_call = true;
3981
+ break ;
3982
+ }
3983
+
3984
+ if (tle -> resname && strcmp (tle -> resname , "lo_unlink" ) == 0 )
3985
+ {
3986
+ ddl_generating_call = true;
3987
+ break ;
3988
+ }
4004
3989
}
4005
3990
4006
- if (ddl_generating_call )
3991
+ if (ddl_generating_call && ! MtmTx . isReplicated )
4007
3992
MtmProcessDDLCommand (ActivePortal -> sourceText , true);
4008
3993
4009
3994
if (PreviousExecutorStartHook != NULL )
0 commit comments