Skip to content

Commit

Permalink
Merge pull request #33 from dalibo/test_GetConfigOption
Browse files Browse the repository at this point in the history
add NULL test on GetConfigOption()
  • Loading branch information
yhuelf committed Jun 30, 2023
2 parents 455c642 + ae9b665 commit 865cf0a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pg_query_settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ execPlantuner(Query *parse, const char *query_st, int cursorOptions, ParamListIn
int64 id;
char *guc_value = NULL;
char *guc_name = NULL;
const char *oldValue = NULL;
parameter *param = NULL;
uint64 queryid = 0;

Expand Down Expand Up @@ -213,7 +214,13 @@ execPlantuner(Query *parse, const char *query_st, int cursorOptions, ParamListIn
param->name = pstrdup(guc_name);

/* Get and store current value for the parameter. */
param->oldValue = pstrdup(GetConfigOption(guc_name, true, false));
oldValue = GetConfigOption(guc_name, true, false);
if (oldValue == NULL)
{
elog(WARNING, "Parameter %s does not exists", guc_name);
continue;
}
param->oldValue = pstrdup(oldValue);

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

Expand Down

0 comments on commit 865cf0a

Please sign in to comment.