8000 Handle NULL for short descriptions of custom GUC variables · postgres/postgres@c3db8a2 · GitHub
[go: up one dir, main page]

Skip to content < 8000 script crossorigin="anonymous" type="application/javascript" src="https://github.githubassets.com/assets/keyboard-shortcuts-dialog-b3dd4b1cb532.js" defer="defer">
8000

Commit c3db8a2

Browse files
committed
Handle NULL for short descriptions of custom GUC variables
If a short description is specified as NULL in one of the various DefineCustomXXXVariable() functions available to external modules to define a custom parameter, SHOW ALL would crash. This change teaches SHOW ALL to properly handle NULL short descriptions, as well as any code paths that manipulate it, to gain in flexibility. Note that help_config.c was already able to do that, when describing a set of GUCs for postgres --describe-config. Author: Steve Chavez Reviewed by: Nathan Bossart, Andres Freund, Michael Paquier, Tom Lane Discussion: https://postgr.es/m/CAGRrpzY6hO-Kmykna_XvsTv8P2DshGiU6G3j8yGao4mk0CqjHA%40mail.gmail.com Backpatch-through: 10
1 parent a44bc8b commit c3db8a2

File tree

1 file changed

+12
-2
lines changed
  • src/backend/utils/misc

1 file changed

+12
-2
lines changed

src/backend/utils/misc/guc.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8322,7 +8322,16 @@ ShowAllGUCConfig(DestReceiver *dest)
83228322
isnull[1] = true;
83238323
}
83248324

8325-
values[2] = PointerGetDatum(cstring_to_text(conf->short_desc));
8325+
if (conf->short_desc)
8326+
{
8327+
values[2] = PointerGetDatum(cstring_to_text(conf->short_desc));
8328+
isnull[2] = false;
8329+
}
8330+
else
8331+
{
8332+
values[2] = PointerGetDatum(NULL);
8333+
isnull[2] = true;
8334+
}
83268335

83278336
/* send it to dest */
83288337
do_tup_output(tstate, values, isnull);
@@ -8334,7 +8343,8 @@ ShowAllGUCConfig(DestReceiver *dest)
83348343
pfree(setting);
83358344
pfree(DatumGetPointer(values[1]));
83368345
}
8337-
pfree(DatumGetPointer(values[2]));
8346+
if (conf->short_desc)
8347+
pfree(DatumGetPointer(values[2]));
83388348
}
83398349

83408350
end_tup_output(tstate);

0 commit comments

Comments
 (0)
0