pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: pgbench: Simplify some port, host, user and dbname assignments
Date: Sat, 06 Mar 2021 12:32:03 +0000
Message-ID: <E1lIW6F-0007nQ-39@gemulon.postgresql.org> (raw)

pgbench: Simplify some port, host, user and dbname assignments

Using pgbench in an environment with both PGPORT and PGUSER set would
have caused the generation of a debug log with an incorrect database
name due to an oversight in 412893b.  Not specifying user, port and/or
database using the option switches, without their respective environment
variables, generated a log entry with empty strings, which was
rather useless.

This commit fixes this set of issues by simplifying the logic grabbing
the connection information, removing a set of getenv() calls that
emulated what libpq already does.  The faulty debug log now directly
uses the information from the libpq connection, and it gets generated
after the connection to the backend is completed, not before it (in the
event of a failure libpq would complain with more information about the
connection attempt so the log is not really useful before anyway).

Author: Kota Miyake
Reviewed-by: Fujii Masao, Michael Paquier
Discussion: https://postgr.es/m/026b3ae6fc339a18394d053c32a4463d@oss.nttdata.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/f1516ad7b3a9645a316846fa7b2229163bc55907

Modified Files
--------------
src/bin/pgbench/pgbench.c | 36 +++++++++++++++---------------------
1 file changed, 15 insertions(+), 21 deletions(-)



Message-ID: <E1lIW6F-0007nQ-39@gemulon.postgresql.org>
Permalink:  ../E1lIW6F-0007nQ-39@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1lIW6F-0007nQ-39@gemulon.postgresql.org

 · 

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-committers@postgresql.org
  Cc: michael@paquier.xyz
  Subject: Re: pgsql: pgbench: Simplify some port, host, user and dbname assignments
  In-Reply-To: <E1lIW6F-0007nQ-39@gemulon.postgresql.org>
  References: <E1lIW6F-0007nQ-39@gemulon.postgresql.org>

* 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