42
42
#include "executor/executor.h"
43
43
#include "access/twophase.h"
44
44
#include "utils/guc.h"
45
+ #include "utils/guc_tables.h"
45
46
#include "utils/hsearch.h"
46
47
#include "utils/timeout.h"
47
48
#include "utils/tqual.h"
@@ -4891,6 +4892,34 @@ static void MtmGucSet(VariableSetStmt *stmt, const char *queryStr)
4891
4892
MemoryContextSwitchTo (oldcontext );
4892
4893
}
4893
4894
4895
+ static int
4896
+ _var_name_cmp (const void * a , const void * b )
4897
+ {
4898
+ const struct config_generic * confa = * (struct config_generic * const * ) a ;
4899
+ const struct config_generic * confb = * (struct config_generic * const * ) b ;
4900
+
4901
+ return strcmp (confa -> name , confb -> name );
4902
+ }
4903
+
4904
+ static struct config_generic *
4905
+ fing_guc_conf (const char * name )
4906
+ {
4907
+ int num ;
4908
+ struct config_generic * * vars ;
4909
+ const char * * key = & name ;
4910
+ struct config_generic * * res ;
4911
+
4912
+ num = GetNumConfigOptions ();
4913
+ vars = get_guc_variables ();
4914
+
4915
+ res = (struct config_generic * * ) bsearch ((void * ) & key ,
4916
+ (void * ) vars ,
4917
+ num , sizeof (struct config_generic * ),
4918
+ _var_name_cmp );
4919
+
4920
+ return res ? * res : NULL ;
4921
+ }
4922
+
4894
4923
char * MtmGucSerialize (void )
4895
4924
{
4896
4925
StringInfo serialized_gucs ;
@@ -4905,6 +4934,7 @@ char* MtmGucSerialize(void)
4905
4934
dlist_foreach (iter , & MtmGucList )
4906
4935
{
4907
4936
MtmGucEntry * cur_entry = dlist_container (MtmGucEntry , list_node , iter .cur );
4937
+ struct config_generic * gconf ;
4908
4938
4909
4939
if (strcmp (cur_entry -> key , "search_path" ) == 0 )
4910
4940
continue ;
@@ -4913,8 +4943,8 @@ char* MtmGucSerialize(void)
4913
4943
appendStringInfoString (serialized_gucs , cur_entry -> key );
4914
4944
appendStringInfoString (serialized_gucs , " TO " );
4915
4945
4916
- /* quite a crutch */
4917
- if (strstr ( cur_entry -> key , "_mem" ) != NULL || * ( cur_entry -> value ) == '\0' )
4946
+ gconf = fing_guc_conf ( cur_entry -> key );
4947
+ if (gconf && ( gconf -> vartype == PGC_STRING || gconf -> flags & ( GUC_UNIT_MEMORY | GUC_UNIT_TIME )) )
4918
4948
{
4919
4949
appendStringInfoString (serialized_gucs , "'" );
4920
4950
appendStringInfoString (serialized_gucs , cur_entry -> value );
0 commit comments