From: | Michael Paquier <michael(at)paquier(dot)xyz> |
---|---|
To: | miyake_kouta <miyake_kouta(at)oss(dot)nttdata(dot)com> |
Cc: | Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: [PATCH] pgbench: Bug fix for the -d option |
Date: | 2021-03-04 12:11:54 |
Message-ID: | YEDOitMXIOu7OLR/@paquier.xyz |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
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 database selection slightly better, but I think
that we can do better and simpler than that. So please see the
attached.
One thing on HEAD that looks like a bug to me is that if one uses a
pgbench command without specifying user, port and/or name in the
command for an environment without PGDATABASE, PGPORT and PGHOST set,
then the debug log just before doConnect() prints empty strings for
all that, which is basically useless so one has no idea where the
connection happens. 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.
What do you think?
--
Michael
Attachment | Content-Type | Size |
---|---|---|
v03_pgbench_debuglogger.patch | text/x-diff | 2.6 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Bharath Rupireddy | 2021-03-04 12:36:45 | Re: Improvements and additions to COPY progress reporting |
Previous Message | Amit Kapila | 2021-03-04 12:05:01 | Re: Parallel INSERT (INTO ... SELECT ...) |