Re: [PATCH] pgbench: Bug fix for the -d option

2021-03-06 Thread Michael Paquier
On Sat, Mar 06, 2021 at 01:19:44PM -0500, Tom Lane wrote: > This item is still open according to the commitfest app --- > should that entry be closed? Thanks. Done. -- Michael signature.asc Description: PGP signature

Re: [PATCH] pgbench: Bug fix for the -d option

2021-03-06 Thread Tom Lane
Michael Paquier writes: > On Fri, Mar 05, 2021 at 06:35:47PM +0900, Fujii Masao wrote: >> Understood. Thanks! > Okay, so I have gone through this stuff today, and applied the > simplification. Thanks. This item is still open according to the commitfest app --- should that entry be closed?

Re: [PATCH] pgbench: Bug fix for the -d option

2021-03-06 Thread Michael Paquier
On Fri, Mar 05, 2021 at 06:35:47PM +0900, Fujii Masao wrote: > Understood. Thanks! Okay, so I have gone through this stuff today, and applied the simplification. Thanks. -- Michael signature.asc Description: PGP signature

Re: [PATCH] pgbench: Bug fix for the -d option

2021-03-05 Thread Fujii Masao
On 2021/03/05 16:33, Michael Paquier wrote: On Fri, Mar 05, 2021 at 01:30:11PM +0900, Fujii Masao wrote: if ((env = getenv("PGDATABASE")) != NULL && *env != '\0') dbName = env; - else if (login != NULL && *login != '\0') -

Re: [PATCH] pgbench: Bug fix for the -d option

2021-03-04 Thread Michael Paquier
On Fri, Mar 05, 2021 at 01:30:11PM +0900, Fujii Masao wrote: > if ((env = getenv("PGDATABASE")) != NULL && *env != '\0') > dbName = env; > - else if (login != NULL && *login != '\0') > - dbName = login; > + else if ((en

Re: [PATCH] pgbench: Bug fix for the -d option

2021-03-04 Thread Fujii Masao
On 2021/03/05 11:26, miyake_kouta wrote: 2021-03-04 21:11, Michael Paquier wrote: Like any other src/bin/ facilities, let's instead remove all the getenv() calls at the beginning of pgbench.c and let's libpq handle those environment variables if the parameters are NULL (aka in the case of no

Re: [PATCH] pgbench: Bug fix for the -d option

2021-03-04 Thread miyake_kouta
2021-03-04 21:11, Michael Paquier wrote: Like any other src/bin/ facilities, let's instead remove all the getenv() calls at the beginning of pgbench.c and let's libpq handle those environment variables if the parameters are NULL (aka in the case of no values given directly in the options). This

Re: [PATCH] pgbench: Bug fix for the -d option

2021-03-04 Thread Michael Paquier
On Tue, Mar 02, 2021 at 11:52:33AM +0900, miyake_kouta wrote: > I modified the patch based on other binaries. > In this new patch, if there is a $PGUSER, then it's set to login. > If not, get_user_name_or_exit is excuted. > Plese let me know what you think about this change. Your patch makes the d

Re: [PATCH] pgbench: Bug fix for the -d option

2021-03-01 Thread miyake_kouta
2021-02-26 20:30, Michael Paquier wrote: By the way, I can help but wonder why pgbench has such a different handling for the user name, fetching first PGUSER and then looking at the options while most of the other binaries use get_user_name(). It seems to me that we could simplify the handling a

Re: [PATCH] pgbench: Bug fix for the -d option

2021-02-26 Thread Michael Paquier
On Fri, Feb 26, 2021 at 05:16:17PM +0900, Michael Paquier wrote: > Yes, the existing code could mess up with the selection logic if > PGPORT and PGUSER are both specified in an environment, masking the > value of PGUSER, so let's fix that. This is as old as 412893b. By the way, I can help but won

Re: [PATCH] pgbench: Bug fix for the -d option

2021-02-26 Thread Michael Paquier
On Fri, Feb 26, 2021 at 01:18:20PM +0900, miyake_kouta wrote: > I'm suggesting this bug fix because I think it's a bug, but if there's any > other intent to this else if statement, could you let me know? Yes, the existing code could mess up with the selection logic if PGPORT and PGUSER are both sp

[PATCH] pgbench: Bug fix for the -d option

2021-02-25 Thread miyake_kouta
Hi. I found a bug in pgbench's -d option and created a patch. The bug is the following: pgbench's option -d can display debug log about connection, which is like "pghost: foo pgport: 5432 nclients: 1 nxacts: 10 dbName: bar". This configuration is supplied by other options or environment variabl