Re: [PATCH] pgbench: Bug fix for the -d option
Fujii Masao <masao.fujii@oss.nttdata.com>
From: Fujii Masao <masao.fujii@oss.nttdata.com>
To: Michael Paquier <michael@paquier.xyz>
Cc: miyake_kouta <miyake_kouta@oss.nttdata.com>,
Pgsql Hackers <pgsql-hackers@postgresql.org>
Date: 2021-03-05T09:35:47Z
Lists: pgsql-hackers
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')
>> - 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?
>
> If you remove this part, pgbench loses some log information if
> PQconnectdbParams() returns NULL, like on OOM if the database name is
> NULL. Perhaps that's not worth caring about here for a single log
> failure, but that's the reason is why I left this part around.
Understood. Thanks!
Regards,
--
Fujii Masao
Advanced Computing Technology Center
Research and Development Headquarters
NTT DATA CORPORATION
Commits
-
pgbench: Simplify some port, host, user and dbname assignments
- f1516ad7b3a9 14.0 landed