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

From: miyake_kouta <miyake_kouta(at)oss(dot)nttdata(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: [PATCH] pgbench: Bug fix for the -d option
Date: 2021-02-26 04:18:20
Message-ID: 026b3ae6fc339a18394d053c32a4463d@oss.nttdata.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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 variables
like PGUSER or PGPORT.
When there is no PGDATABASE, pgbench will use PGUSER as the dbName.
However, when there is PGPORT environment variable, this debug logger
doesn't refer PGUSER even if there is PGUSER.
In other words, even if you are setting both PGPORT and PGUSER,
pgbench's option -d will display like this: "pghost: foo pgport: 5432
nclients: 1 nxact: 10 dbName: ".
I think this is a bug that dbName is displayed as if it's not specified.
Note that this bug is only related to this debug logger. The main unit
of pgbench can establish a connection by complementing dbName with
PGUSER despite this bug.

So I made a patch (only one line changed).
As shown in this patch file, I just changed the else if statement to an
if statement.
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?

Regards
---
Kota Miyake

Attachment Content-Type Size
pgbench_debuglogger.patch text/x-diff 491 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2021-02-26 04:26:25 Re: [HACKERS] logical decoding of two-phase transactions
Previous Message Tom Lane 2021-02-26 03:51:47 Re: Some regular-expression performance hacking