@@ -3599,6 +3599,7 @@ typedef struct MtmGucHashEntry
3599
3599
} MtmGucHashEntry ;
3600
3600
3601
3601
static HTAB * MtmGucHash = NULL ;
3602
+ static List * MtmGucList = NULL ;
3602
3603
3603
3604
static void MtmGucHashInit (void )
3604
3605
{
@@ -3619,7 +3620,6 @@ static void MtmGucSet(VariableSetStmt *stmt, const char *queryStr)
3619
3620
MemoryContext oldcontext ;
3620
3621
MtmGucHashEntry * hentry ;
3621
3622
bool found ;
3622
- char * key ;
3623
3623
3624
3624
if (!MtmGucHash )
3625
3625
MtmGucHashInit ();
@@ -3629,54 +3629,30 @@ static void MtmGucSet(VariableSetStmt *stmt, const char *queryStr)
3629
3629
switch (stmt -> kind )
3630
3630
{
3631
3631
case VAR_SET_VALUE :
3632
- case VAR_SET_DEFAULT :
3633
- case VAR_SET_CURRENT :
3634
- {
3635
- char * value ;
3636
-
3637
- key = pstrdup (stmt -> name );
3638
- hash_search (MtmGucHash , key , HASH_FIND , & found );
3639
- value = ExtractSetVariableArgs (stmt );
3640
-
3641
- fprintf (stderr , ":MtmGucSet: %s -> %s\n" , key , value );
3642
-
3643
- if (value )
3644
- {
3645
- hentry = (MtmGucHashEntry * ) hash_search (MtmGucHash , key ,
3646
- HASH_ENTER , & found );
3647
-
3648
- // if (found)
3649
- // pfree(hentry->value);
3632
+ hentry = (MtmGucHashEntry * ) hash_search (MtmGucHash , stmt -> name ,
3633
+ HASH_ENTER , & found );
3634
+ if (found )
3635
+ pfree (hentry -> value );
3636
+ hentry -> value = ExtractSetVariableArgs (stmt );
3637
+ break ;
3650
3638
3651
- hentry -> value = palloc (strlen (value ) + 1 );
3652
- strcpy (hentry -> value , value );
3653
- }
3654
- else if (found )
3655
- {
3656
- /* That was SET TO DEFAULT and we already had some value */
3657
- hash_search (MtmGucHash , key , HASH_REMOVE , NULL );
3658
- }
3659
- }
3639
+ case VAR_SET_DEFAULT :
3640
+ hash_search (MtmGucHash , stmt -> name , HASH_REMOVE , NULL );
3660
3641
break ;
3661
3642
3662
3643
case VAR_RESET :
3663
- {
3664
- if (strcmp (stmt -> name , "session_authorization" ) == 0 )
3665
- {
3666
- hash_search (MtmGucHash , "role" , HASH_REMOVE , NULL );
3667
- }
3668
- key = pstrdup (stmt -> name );
3669
- hash_search (MtmGucHash , key , HASH_REMOVE , NULL );
3670
- }
3644
+ if (strcmp (stmt -> name , "session_authorization" ) == 0 )
3645
+ hash_search (MtmGucHash , "role" , HASH_REMOVE , NULL );
3646
+ hash_search (MtmGucHash , stmt -> name , HASH_REMOVE , NULL );
3671
3647
break ;
3672
3648
3673
3649
case VAR_RESET_ALL :
3674
- {
3675
- hash_destroy (MtmGucHash );
3676
- MtmGucHashInit ();
3677
- }
3650
+ /* XXX: shouldn't we keep auth/role here? */
3651
+ hash_destroy (MtmGucHash );
3652
+ MtmGucHashInit ();
3678
3653
break ;
3679
3654
3655
+ case VAR_SET_CURRENT :
3680
3656
case VAR_SET_MULTI :
3681
3657
break ;
3682
3658
}
@@ -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