Skip to content

Commit

Permalink
add NULL test on GetConfigOption()
Browse files Browse the repository at this point in the history
  • Loading branch information
tilkow committed Jun 29, 2023
1 parent 455c642 commit ae9b665
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 ae9b665

Please sign in to comment.