Re: Allow specifying a dbname in pg_basebackup connection string

Jelte Fennema <me@jeltef.nl>

From: Jelte Fennema-Nio <me@jeltef.nl>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Daniel Gustafsson <daniel@yesql.se>, Jim Jones <jim.jones@uni-muenster.de>, Tristen Raab <tristen.raab@highgo.ca>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>, Jelte Fennema <github-tech@jeltef.nl>
Date: 2024-11-04T18:20:59Z
Lists: pgsql-hackers
On Mon, 4 Nov 2024 at 18:14, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> perhaps under the illusion that dbname and connection_string can't
> both be NULL.

Yeah, I'm pretty sure I didn't realise that was an option. I think I
probably misinterpreted this comment (might be nice to clarify there
that both being NULL is also a valid option):

    /* pg_recvlogical uses dbname only; others use connection_string only. */
    Assert(dbname == NULL || connection_string == NULL);


> I think the attached will fix it, but I wonder if there are edge
> cases I'm not thinking of.

Yeah that patch looks good to me. Reading the patch carefully again I
cannot think there are other changes in behaviour (except the ones
intended by the change).



Commits

  1. pg_basebackup, pg_receivewal: fix failure to find password in ~/.pgpass.

  2. Allow dbname in pg_basebackup/pg_receivewal connstring