Hi.I found some redundant code in psql/help.c, so I propose a patch to fix it. In the current help.c, the variable "user" is set to the value of $PGUSER (or get_user_name).
However, $PGUSER is referenced again in the code that follows. We can replace this part with "user", I think.
Regards. -- Kota Miyake
diff --git a/src/bin/psql/help.c b/src/bin/psql/help.c index e44120bf76..75a2217cac 100644 --- a/src/bin/psql/help.c +++ b/src/bin/psql/help.c @@ -134,9 +134,7 @@ usage(unsigned short int pager) fprintf(output, _(" -p, --port=PORT database server port (default: \"%s\")\n"), env ? env : DEF_PGPORT_STR); /* Display default user */ - env = getenv("PGUSER"); - if (!env) - env = user; + env = user; fprintf(output, _(" -U, --username=USERNAME database user name (default: \"%s\")\n"), env); fprintf(output, _(" -w, --no-password never prompt for password\n")); fprintf(output, _(" -W, --password force password prompt (should happen automatically)\n"));