pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: miyake_kouta <miyake_kouta@oss.nttdata.com>
To: Pgsql Hackers <pgsql-hackers@postgresql.org>
Subject: [PATCH] psql : Improve code for help option
Date: Tue, 02 Mar 2021 11:57:37 +0900
Message-ID: <2a3c612babdd6ed63a9d877bb575d793@oss.nttdata.com> (raw)

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

Attachments:

psql_help.patch (text/x-diff, 698B) download 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"));

view thread (6+ messages)  latest in thread

Message-ID: <2a3c612babdd6ed63a9d877bb575d793@oss.nttdata.com>
Permalink:  ../2a3c612babdd6ed63a9d877bb575d793@oss.nttdata.com/
Also on:    postgresql.org/message-id/2a3c612babdd6ed63a9d877bb575d793@oss.nttdata.com

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-hackers@postgresql.org
  Cc: miyake_kouta@oss.nttdata.com
  Subject: Re: [PATCH] psql : Improve code for help option
  In-Reply-To: <2a3c612babdd6ed63a9d877bb575d793@oss.nttdata.com>
  References: <2a3c612babdd6ed63a9d877bb575d793@oss.nttdata.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox