Skip to content

Commit

Permalink
fix parameters restoration
Browse files Browse the repository at this point in the history
  • Loading branch information
yhuelf committed Jun 29, 2023
1 parent 9bc31c8 commit 5f1bdc4
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pg_query_settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ static const char* pgqs_config ="pgqs_config";
typedef struct parameter
{
char *name;
const char *oldValue;
char *oldValue;
slist_node node;
} parameter;

Expand Down Expand Up @@ -126,6 +126,8 @@ static void DestroyPRList(bool reset)
SetConfigOption(param->name, param->oldValue, PGC_USERSET, PGC_S_SESSION);
}
slist_delete_current(&iter);
free(param->name);
free(param->oldValue);
free(param);
}
}
Expand Down Expand Up @@ -210,10 +212,10 @@ execPlantuner(Query *parse, const char *query_st, int cursorOptions, ParamListIn
guc_value = pstrdup(TextDatumGetCString(data));

param = malloc(sizeof(parameter));
param->name = guc_name;
param->name = strdup(guc_name);

/* Get and store current value for the parameter. */
param->oldValue = GetConfigOption(guc_name, true, false);
param->oldValue = strdup(GetConfigOption(guc_name, true, false));

slist_push_head(&paramResetList, &param->node);

Expand Down

0 comments on commit 5f1bdc4

Please sign in to comment.