Fix latent bug in get_stats_option_name()

The function is supposed to look at the passed in 'arg' argument, but
peeks at the 'optarg' global variable that's part of getopt()
instead. It happened to work anyway, because all callers passed
'optarg' as the argument.

Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Discussion: https://www.postgresql.org/message-id/d1da5f0e-0d68-47c9-a882-eb22f462752f@iki.fi
This commit is contained in:
Heikki Linnakangas 2026-03-30 20:34:48 +03:00
parent 50eb5faea2
commit c5f7820e57

View file

@ -3796,9 +3796,9 @@ get_stats_option_name(const char *arg)
switch (arg[0])
{
case 'p':
if (optarg[1] == 'a') /* "parser" */
if (arg[1] == 'a') /* "parser" */
return "log_parser_stats";
else if (optarg[1] == 'l') /* "planner" */
else if (arg[1] == 'l') /* "planner" */
return "log_planner_stats";
break;