Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf1431f3

Browse files
committed
Handle NULL for short descriptions of custom GUC variables
If a short description is specified as NULL in one of the variousDefineCustomXXXVariable() functions available to external modules todefine a custom parameter, SHOW ALL would crash. This change teachesSHOW ALL to properly handle NULL short descriptions, as well as any codepaths that manipulate it, to gain in flexibility. Note thathelp_config.c was already able to do that, when describing a set of GUCsfor postgres --describe-config.Author: Steve ChavezReviewed by: Nathan Bossart, Andres Freund, Michael Paquier, Tom LaneDiscussion:https://postgr.es/m/CAGRrpzY6hO-Kmykna_XvsTv8P2DshGiU6G3j8yGao4mk0CqjHA%40mail.gmail.comBackpatch-through: 10
1 parent3e9abd2 commitf1431f3

File tree

1 file changed

+13
-3
lines changed
  • src/backend/utils/misc

1 file changed

+13
-3
lines changed

‎src/backend/utils/misc/guc.c

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9780,7 +9780,16 @@ ShowAllGUCConfig(DestReceiver *dest)
97809780
isnull[1]= true;
97819781
}
97829782

9783-
values[2]=PointerGetDatum(cstring_to_text(conf->short_desc));
9783+
if (conf->short_desc)
9784+
{
9785+
values[2]=PointerGetDatum(cstring_to_text(conf->short_desc));
9786+
isnull[2]= false;
9787+
}
9788+
else
9789+
{
9790+
values[2]=PointerGetDatum(NULL);
9791+
isnull[2]= true;
9792+
}
97849793

97859794
/* send it to dest */
97869795
do_tup_output(tstate,values,isnull);
@@ -9792,7 +9801,8 @@ ShowAllGUCConfig(DestReceiver *dest)
97929801
pfree(setting);
97939802
pfree(DatumGetPointer(values[1]));
97949803
}
9795-
pfree(DatumGetPointer(values[2]));
9804+
if (conf->short_desc)
9805+
pfree(DatumGetPointer(values[2]));
97969806
}
97979807

97989808
end_tup_output(tstate);
@@ -10002,7 +10012,7 @@ GetConfigOptionByNum(int varnum, const char **values, bool *noshow)
1000210012
values[3]=_(config_group_names[conf->group]);
1000310013

1000410014
/* short_desc */
10005-
values[4]=_(conf->short_desc);
10015+
values[4]=conf->short_desc!=NULL ?_(conf->short_desc) :NULL;
1000610016

1000710017
/* extra_desc */
1000810018
values[5]=conf->long_desc!=NULL ?_(conf->long_desc) :NULL;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp