Re: Allow specifying a dbname in pg_basebackup connection string

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Daniel Gustafsson <daniel(at)yesql(dot)se>
Cc: Jelte Fennema <me(at)jeltef(dot)nl>, Jim Jones <jim(dot)jones(at)uni-muenster(dot)de>, Tristen Raab <tristen(dot)raab(at)highgo(dot)ca>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Jelte Fennema <github-tech(at)jeltef(dot)nl>
Subject: Re: Allow specifying a dbname in pg_basebackup connection string
Date: 2024-11-04 18:57:32
Message-ID: 2879235.1730746652@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Daniel Gustafsson <daniel(at)yesql(dot)se> writes:
> +1 on your patch, reading through I can't see anything it misses. Maybe a
> comment above the change with a note on why dbname is tested for NULL there
> would be good?

I thought Jelte's suggestion of clarifying the first comment was good:

- /* pg_recvlogical uses dbname only; others use connection_string only. */
+ /*
+ * pg_recvlogical uses dbname only; others use connection_string only.
+ * (Note: both variables will be NULL if there's no command line options.)
+ */
Assert(dbname == NULL || connection_string == NULL);

Also, I realized that the associated documentation is pretty much a
lie:

... any database
name in the connection string will be ignored
by <productname>PostgreSQL</productname>.

Maybe that's true for a very narrow interpretation of "PostgreSQL",
but I think most people would consider that pg_basebackup's lookup
of ~/.pgpass entries is covered. I'm intending to go with the
attached.

regards, tom lane

Attachment Content-Type Size
v2-fix-pg_basebackup-pgpass-matching.patch text/x-diff 2.8 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexander Korotkov 2024-11-04 19:04:25 Re: pgsql: Implement pg_wal_replay_wait() stored procedure
Previous Message Daniel Gustafsson 2024-11-04 18:49:45 Re: pg_dump --no-comments confusion