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

From: Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>
To: miyake_kouta <miyake_kouta(at)oss(dot)nttdata(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCH] pgbench: Bug fix for the -d option
Date: 2021-03-05 04:30:11
Message-ID: fe7780f0-9a11-b4f4-be94-5eef6086ff1e@oss.nttdata.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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 values given directly in the options).  This
>> requires to move the debug log after doConnect(), which is no big deal
>> anyway as a failure results in an exit(1) immediately with a log
>> telling where the connection failed.

if ((env = getenv("PGDATABASE")) != NULL && *env != '\0')
dbName = env;
- else if (login != NULL && *login != '\0')
- dbName = login;
+ else if ((env = getenv("PGUSER")) != NULL && *env != '\0')
+ dbName = env;
else
- dbName = "";
+ dbName = get_user_name_or_exit(progname);

If dbName is set by libpq, the above also is not necessary?

Regards,

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Munro 2021-03-05 04:30:58 Re: 011_crash_recovery.pl intermittently fails
Previous Message Kyotaro Horiguchi 2021-03-05 04:21:48 Re: 011_crash_recovery.pl intermittently fails