[PATCH] psql : Improve code for help option

Started by miyake_koutaover 5 years ago6 messageshackers
Jump to latest
#1miyake_kouta
miyake_kouta@oss.nttdata.com

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.patchtext/x-diff; name=psql_help.patchDownload+1-3
#2Fujii Masao
masao.fujii@oss.nttdata.com
In reply to: miyake_kouta (#1)
Re: [PATCH] psql : Improve code for help option

On 2021/03/02 11:57, miyake_kouta wrote:

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.

Good catch!

fprintf(output, _(" -U, --username=USERNAME database user name (default: \"%s\")\n"), env);

We can simplify the code more and remove "env = user"
by just using "user" instead of "env" in the above?

Regards,

--
Fujii Masao
Advanced Computing Technology Center
Research and Development Headquarters
NTT DATA CORPORATION

#3miyake_kouta
miyake_kouta@oss.nttdata.com
In reply to: Fujii Masao (#2)
Re: [PATCH] psql : Improve code for help option

2021-03-03 00:09, Fujii Masao wrote:

We can simplify the code more and remove "env = user"
by just using "user" instead of "env" in the above?

Thank you for your comment.
I updated my patch and replaced "env" with "user".
Please check.

Regards.
--
Kota Miyake

Attachments:

v02_psql_help.patchtext/x-diff; name=v02_psql_help.patchDownload+1-5
#4Fujii Masao
masao.fujii@oss.nttdata.com
In reply to: miyake_kouta (#3)
Re: [PATCH] psql : Improve code for help option

On 2021/03/03 12:27, miyake_kouta wrote:

2021-03-03 00:09, Fujii Masao wrote:

We can simplify the code more and remove "env = user"
by just using "user" instead of "env" in the above?

Thank you for your comment.
I updated my patch and replaced "env" with "user".
Please check.

Thanks for updating the patch!
LGTM. Barrying any objection, I will commit this patch.

Regards,

--
Fujii Masao
Advanced Computing Technology Center
Research and Development Headquarters
NTT DATA CORPORATION

#5Nitin Jadhav
nitinjadhavpostgres@gmail.com
In reply to: Fujii Masao (#4)
Re: [PATCH] psql : Improve code for help option

Hi,

I have reviewed the patch and it looks good to me.

Thanks and Regards,
Nitin Jadhav

On Wed, Mar 3, 2021 at 1:09 PM Fujii Masao <masao.fujii@oss.nttdata.com>
wrote:

Show quoted text

On 2021/03/03 12:27, miyake_kouta wrote:

2021-03-03 00:09, Fujii Masao wrote:

We can simplify the code more and remove "env = user"
by just using "user" instead of "env" in the above?

Thank you for your comment.
I updated my patch and replaced "env" with "user".
Please check.

Thanks for updating the patch!
LGTM. Barrying any objection, I will commit this patch.

Regards,

--
Fujii Masao
Advanced Computing Technology Center
Research and Development Headquarters
NTT DATA CORPORATION

#6Fujii Masao
masao.fujii@oss.nttdata.com
In reply to: Nitin Jadhav (#5)
Re: [PATCH] psql : Improve code for help option

On 2021/03/03 17:05, Nitin Jadhav wrote:

Hi,

I have reviewed the patch and it looks good to me.

Thanks! Pushed.

Regards,

--
Fujii Masao
Advanced Computing Technology Center
Research and Development Headquarters
NTT DATA CORPORATION