Lists: | pgsql-hackers |
---|
From: | Jelte Fennema <postgres(at)jeltef(dot)nl> |
---|---|
To: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Allow specifying a dbname in pg_basebackup connection string |
Date: | 2023-07-03 12:22:40 |
Message-ID: | CAGECzQTw-dZkVT_RELRzfWRzY714-VaTjoBATYfZq93R8C-auA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
Normally it doesn't really matter which dbname is used in the connection
string that pg_basebackup and other physical replication CLI tools use.
The reason being, that physical replication does not work at the
database level, but instead at the server level. So you will always get
the data for all databases.
However, when there's a proxy, such as PgBouncer, in between the client
and the server, then it might very well matter. Because this proxy might
want to route the connection to a different server depending on the
dbname parameter in the startup packet.
This patch changes the creation of the connection string key value
pairs, so that the following command will actually include
dbname=postgres in the startup packet to the server:
pg_basebackup --dbname 'dbname=postgres port=6432' -D dump
This also applies to other physical replication CLI tools like
pg_receivewal.
To address the security issue described in CVE-2016-5424 it
now only passes expand_dbname=true when the tool did not
receive a connection_string argument.
I tested that the change worked on this PgBouncer PR of mine:
https://github.com/pgbouncer/pgbouncer/pull/876
Attachment | Content-Type | Size |
---|---|---|
v1-0001-Allow-specifying-a-dbname-in-pg_basebackup-connec.patch | application/octet-stream | 3.6 KB |
From: | Thom Brown <thom(at)linux(dot)com> |
---|---|
To: | Jelte Fennema <postgres(at)jeltef(dot)nl> |
Cc: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Allow specifying a dbname in pg_basebackup connection string |
Date: | 2023-07-05 12:43:35 |
Message-ID: | CAA-aLv6QHjBPZtGjy2mpP=1r4+vW=buigGUpU-cVqTLU=ARVNg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Mon, 3 Jul 2023 at 13:23, Jelte Fennema <postgres(at)jeltef(dot)nl> wrote:
>
> Normally it doesn't really matter which dbname is used in the connection
> string that pg_basebackup and other physical replication CLI tools use.
> The reason being, that physical replication does not work at the
> database level, but instead at the server level. So you will always get
> the data for all databases.
>
> However, when there's a proxy, such as PgBouncer, in between the client
> and the server, then it might very well matter. Because this proxy might
> want to route the connection to a different server depending on the
> dbname parameter in the startup packet.
>
> This patch changes the creation of the connection string key value
> pairs, so that the following command will actually include
> dbname=postgres in the startup packet to the server:
>
> pg_basebackup --dbname 'dbname=postgres port=6432' -D dump
I guess my immediate question is, should backups be taken through
PgBouncer? It seems beyond PgBouncer's remit.
Thom
From: | "Euler Taveira" <euler(at)eulerto(dot)com> |
---|---|
To: | "Thom Brown" <thom(at)linux(dot)com>, "Jelte Fennema" <postgres(at)jeltef(dot)nl> |
Cc: | pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Allow specifying a dbname in pg_basebackup connection string |
Date: | 2023-07-05 14:01:08 |
Message-ID: | 1701b621-4525-4a11-89fa-34b426aff32a@app.fastmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Wed, Jul 5, 2023, at 9:43 AM, Thom Brown wrote:
> I guess my immediate question is, should backups be taken through
> PgBouncer? It seems beyond PgBouncer's remit.
One of the PgBouncer's missions is to be a transparent proxy.
Sometimes you cannot reach out the database directly due to a security policy.
I've heard this backup question a few times. IMO if dbname doesn't matter for
reaching the server directly, I don't see a problem relaxing this restriction
to support this use case. We just need to document that dbname will be ignored
if specified. Other connection poolers might also benefit from it.
--
Euler Taveira
EDB https://www.enterprisedb.com/
From: | Jelte Fennema <postgres(at)jeltef(dot)nl> |
---|---|
To: | Euler Taveira <euler(at)eulerto(dot)com> |
Cc: | Thom Brown <thom(at)linux(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Allow specifying a dbname in pg_basebackup connection string |
Date: | 2023-07-05 15:50:01 |
Message-ID: | CAGECzQSv_zXsjTGhDMQW3Z3fHBzorg6as5ojJjLAO2wQrGuurg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Wed, 5 Jul 2023 at 16:01, Euler Taveira <euler(at)eulerto(dot)com> wrote:
> One of the PgBouncer's missions is to be a transparent proxy.
>
> Sometimes you cannot reach out the database directly due to a security policy.
Indeed the transparent proxy use case is where replication through
pgbouncer makes sense. There's quite some reasons to set up PgBouncer
like such a proxy apart from security policies. Some others that come
to mind are:
- load balancer layer of pgbouncers
- transparent failovers
- transparent database moves
And in all of those cases its nice for a user to use a single
connection string/hostname. Instead of having to think: Oh yeah, for
backups, I need to use this other one.
From: | Thom Brown <thom(at)linux(dot)com> |
---|---|
To: | Jelte Fennema <postgres(at)jeltef(dot)nl> |
Cc: | Euler Taveira <euler(at)eulerto(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Allow specifying a dbname in pg_basebackup connection string |
Date: | 2023-07-05 18:08:49 |
Message-ID: | CAA-aLv6Zq062KUDQxVv8Om=uB=FP2qeAnFk4aztUBNBobgn0NQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Wed, 5 Jul 2023 at 16:50, Jelte Fennema <postgres(at)jeltef(dot)nl> wrote:
>
> On Wed, 5 Jul 2023 at 16:01, Euler Taveira <euler(at)eulerto(dot)com> wrote:
> > One of the PgBouncer's missions is to be a transparent proxy.
> >
> > Sometimes you cannot reach out the database directly due to a security policy.
>
> Indeed the transparent proxy use case is where replication through
> pgbouncer makes sense. There's quite some reasons to set up PgBouncer
> like such a proxy apart from security policies. Some others that come
> to mind are:
> - load balancer layer of pgbouncers
> - transparent failovers
> - transparent database moves
>
> And in all of those cases its nice for a user to use a single
> connection string/hostname. Instead of having to think: Oh yeah, for
> backups, I need to use this other one.
Okay, understood. In that case, please remember to write changes to
the pg_basebackup docs page explaining how the dbname value is ignored
under normal usage.
Thom
From: | Jelte Fennema <postgres(at)jeltef(dot)nl> |
---|---|
To: | Thom Brown <thom(at)linux(dot)com> |
Cc: | Euler Taveira <euler(at)eulerto(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Allow specifying a dbname in pg_basebackup connection string |
Date: | 2023-07-05 19:39:40 |
Message-ID: | CAGECzQTH6Nqsgq4-bRAD2N-QQmtF30bQMQ=Y=NKp2A41Zd8TLA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Wed, 5 Jul 2023 at 20:09, Thom Brown <thom(at)linux(dot)com> wrote:
> Okay, understood. In that case, please remember to write changes to
> the pg_basebackup docs page explaining how the dbname value is ignored
I updated the wording in the docs for pg_basebackup and pg_receivewal.
They now clarify that Postgres itself doesn't care if there's a
database name in the connection string, but that a proxy might.
Attachment | Content-Type | Size |
---|---|---|
v2-0001-Allow-specifying-a-dbname-in-pg_basebackup-connec.patch | application/octet-stream | 5.9 KB |
From: | Tristen Raab <tristen(dot)raab(at)highgo(dot)ca> |
---|---|
To: | pgsql-hackers(at)lists(dot)postgresql(dot)org |
Cc: | Jelte Fennema <github-tech(at)jeltef(dot)nl> |
Subject: | Re: Allow specifying a dbname in pg_basebackup connection string |
Date: | 2023-08-28 21:49:41 |
Message-ID: | 169325938134.1124.11129493970278129501.pgcf@coridan.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
The following review has been posted through the commitfest application:
make installcheck-world: tested, passed
Implements feature: tested, passed
Spec compliant: not tested
Documentation: not tested
Hello,
I've reviewed your patch and it applies and builds without error. When testing this patch I was slightly confused as to what its purpose was, after testing it I now understand. Initially, I thought this was a change to add database-level replication. I would suggest some clarifications to the documentation such as changing:
"supplying a specific database name in the connection string won't cause PostgreSQL to behave any differently."
to
"supplying a specific database name in the connection string won't cause pg_basebackup to behave any differently."
I believe this better illustrates that we are referring to the actual pg_basebackup utility and how this parameter is only used for proxies and bears no impact on what pg_basebackup is actually doing. It also would remove any confusion about database replication I had prior.
There is also a small typo in the same documentation:
"However, if you are connecting to PostgreSQL through a proxy, then it's possible that this proxy does use the supplied databasename to make certain decisions, such as to which cluster to route the connection."
"databasename" is just missing a space.
Other than that, everything looks good.
Regards,
Tristen
From: | Jelte Fennema <me(at)jeltef(dot)nl> |
---|---|
To: | Tristen Raab <tristen(dot)raab(at)highgo(dot)ca> |
Cc: | 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: | 2023-08-29 13:55:05 |
Message-ID: | CAGECzQTEXbhQYOhxWAiGWqc-Ec_av1qi688kyDTkpyALUidSVQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | Postg메이저 토토 사이트SQL |
On Mon, 28 Aug 2023 at 23:50, Tristen Raab <tristen(dot)raab(at)highgo(dot)ca> wrote:
> I've reviewed your patch and it applies and builds without error. When testing this patch I was slightly confused as to what its purpose was, after testing it I now understand. Initially, I thought this was a change to add database-level replication. I would suggest some clarifications to the documentation such as changing:
Thanks for the review. I've updated the documentation to make it
clearer (using some of your suggestions but also some others)
Attachment | Content-Type | Size |
---|---|---|
v3-0001-Allow-specifying-a-dbname-in-pg_basebackup-connec.patch | application/octet-stream | 6.1 KB |
From: | Jim Jones <jim(dot)jones(at)uni-muenster(dot)de> |
---|---|
To: | Jelte Fennema <me(at)jeltef(dot)nl>, Tristen Raab <tristen(dot)raab(at)highgo(dot)ca> |
Cc: | 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: | 2023-08-29 23:01:39 |
Message-ID: | c94413f9-4ae4-daa9-5897-785b83186ec9@uni-muenster.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
Hi Jelte
On 29.08.23 15:55, Jelte Fennema wrote:
> Thanks for the review. I've updated the documentation to make it
> clearer (using some of your suggestions but also some others)
This patch applies and builds cleanly, and the documentation is very clear.
I tested it using the 'replication-support' branch from your github fork:
/pg_basebackup --dbname "port=6432 user=postgres dbname=foo" -D /tmp/dump1/
pgbouncer log:
/2023-08-30 00:50:52.866 CEST [811770] LOG C-0x555fbd65bf40:
(nodb)/postgres(at)unix(811776):6432 login attempt: db=foo user=postgres
tls=no replication=yes/
However, pgbouncer closes with a segmentation fault, so I couldn't test
the result of pg_basebackup itself - but I guess it isn't the issue here.
Other than that, everything looks good to me.
Jim
From: | Jelte Fennema <me(at)jeltef(dot)nl> |
---|---|
To: | Jim Jones <jim(dot)jones(at)uni-muenster(dot)de> |
Cc: | Tristen Raab <tristen(dot)raab(at)highgo(dot)ca>, 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: | 2023-08-30 12:11:07 |
Message-ID: | CAGECzQSqBfLS9D_DvUA5=bJeVaeWFAT2TOvjBNW8tVpAfXAAPg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Wed, 30 Aug 2023 at 01:01, Jim Jones <jim(dot)jones(at)uni-muenster(dot)de> wrote:
> However, pgbouncer closes with a segmentation fault, so I couldn't test the result of pg_basebackup itself - but I guess it isn't the issue here.
Oops it indeed seemed like I made an unintended change when handling
database names that did not exist in pgbouncer.conf when you used
auth_type=hba. I pushed a fix for that now to the replication-support
branch. Feel free to try again. But as you said it's unrelated to the
postgres patch.
From: | Jim Jones <jim(dot)jones(at)uni-muenster(dot)de> |
---|---|
To: | Jelte Fennema <me(at)jeltef(dot)nl> |
Cc: | Tristen Raab <tristen(dot)raab(at)highgo(dot)ca>, 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: | 2023-08-30 19:08:33 |
Message-ID: | a0fa5269-be91-25bd-329e-379f211b500e@uni-muenster.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On 30.08.23 14:11, Jelte Fennema wrote:
> Oops it indeed seemed like I made an unintended change when handling
> database names that did not exist in pgbouncer.conf when you used
> auth_type=hba. I pushed a fix for that now to the replication-support
> branch. Feel free to try again. But as you said it's unrelated to the
> postgres patch.
Nice! Now it seems to work as expected :)
$ /usr/local/postgres-dev/bin/pg_basebackup --dbname "host=127.0.0.1
port=6432 user=jim dbname=foo" -X fetch -v -l testlabel -D /tmp/dump
pg_basebackup: initiating base backup, waiting for checkpoint to complete
pg_basebackup: checkpoint completed
pg_basebackup: write-ahead log start point: 0/12000028 on timeline 1
pg_basebackup: write-ahead log end point: 0/12000100
pg_basebackup: syncing data to disk ...
pg_basebackup: renaming backup_manifest.tmp to backup_manifest
pg_basebackup: base backup completed
pgbouncer log:
2023-08-30 21:04:30.225 CEST [785989] LOG C-0x55fbee0f50b0:
foo/jim(at)127(dot)0(dot)0(dot)1:49764 login attempt: db=foo user=jim tls=no
replication=yes
2023-08-30 21:04:30.225 CEST [785989] LOG S-0x55fbee0fc560:
foo/jim(at)127(dot)0(dot)0(dot)1:5432 new connection to server (from 127.0.0.1:34400)
2023-08-30 21:04:30.226 CEST [785989] LOG S-0x55fbee0fc560:
foo/jim(at)127(dot)0(dot)0(dot)1:5432 closing because: replication client was closed
(age=0s)
2023-08-30 21:04:30.226 CEST [785989] LOG S-0x55fbee0fc560:
foo/jim(at)127(dot)0(dot)0(dot)1:5432 new connection to server (from 127.0.0.1:34408)
2023-08-30 21:04:30.227 CEST [785989] LOG S-0x55fbee0fc560:
foo/jim(at)127(dot)0(dot)0(dot)1:5432 closing because: replication client was closed
(age=0s)
2023-08-30 21:04:30.227 CEST [785989] LOG S-0x55fbee0fc560:
foo/jim(at)127(dot)0(dot)0(dot)1:5432 new connection to server (from 127.0.0.1:34410)
2023-08-30 21:04:30.228 CEST [785989] LOG S-0x55fbee0fc560:
foo/jim(at)127(dot)0(dot)0(dot)1:5432 closing because: replication client was closed
(age=0s)
2023-08-30 21:04:30.228 CEST [785989] LOG S-0x55fbee0fc560:
foo/jim(at)127(dot)0(dot)0(dot)1:5432 new connection to server (from 127.0.0.1:34418)
2023-08-30 21:04:30.309 CEST [785989] LOG S-0x55fbee0fc560:
foo/jim(at)127(dot)0(dot)0(dot)1:5432 closing because: replication client was closed
(age=0s)
2023-08-30 21:04:30.309 CEST [785989] LOG C-0x55fbee0f50b0:
foo/jim(at)127(dot)0(dot)0(dot)1:49764 closing because: client close request (age=0s)
Jim
From: | Jelte Fennema <me(at)jeltef(dot)nl> |
---|---|
To: | Jim Jones <jim(dot)jones(at)uni-muenster(dot)de> |
Cc: | Tristen Raab <tristen(dot)raab(at)highgo(dot)ca>, 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: | 2023-08-31 09:01:07 |
Message-ID: | CAGECzQRoJ2mCbBBtm5wiFrgxg91gf4T2DGETB+WpWN071thxig@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
Attached is a new version with some slightly updated wording in the docs
Attachment | Content-Type | Size |
---|---|---|
v4-0001-Allow-specifying-a-dbname-in-pg_basebackup-connec.patch | application/octet-stream | 6.2 KB |
From: | Daniel Gustafsson <daniel(at)yesql(dot)se> |
---|---|
To: | Jelte Fennema <me(at)jeltef(dot)nl> |
Cc: | Jim Jones <jim(dot)jones(at)uni-muenster(dot)de>, Tristen Raab <tristen(dot)raab(at)highgo(dot)ca>, 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: | 2023-09-18 12:11:13 |
Message-ID: | 83D8FE79-05D3-4C1E-858D-FD9F49C736A3@yesql.se |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
> On 31 Aug 2023, at 11:01, Jelte Fennema <me(at)jeltef(dot)nl> wrote:
> Attached is a new version with some slightly updated wording in the docs
I had a look at this Ready for Committer entry in the CF and it seems to strike
a balance between useful in certain cases and non-intrusive in others.
Unless something sticks out in a second pass over it I will go ahead and apply
it.
--
Daniel Gustafsson
From: | Daniel Gustafsson <daniel(at)yesql(dot)se> |
---|---|
To: | Jelte Fennema <me(at)jeltef(dot)nl> |
Cc: | 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: | 2023-09-21 12:53:11 |
Message-ID: | 2C904913-C60F-4941-AD3E-F2D2A3483E91@yesql.se |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
> On 18 Sep 2023, at 14:11, Daniel Gustafsson <daniel(at)yesql(dot)se> wrote:
> Unless something sticks out in a second pass over it I will go ahead and apply
> it.
And applied, closing the CF entry.
--
Daniel Gustafsson
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 17:14:16 |
Message-ID: | 2702546.1730740456@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
Daniel Gustafsson <daniel(at)yesql(dot)se> writes:
> On 18 Sep 2023, at 14:11, Daniel Gustafsson <daniel(at)yesql(dot)se> wrote:
>> Unless something sticks out in a second pass over it I will go ahead and apply
>> it.
> And applied, closing the CF entry.
I believe this patch (commit cca97ce6a) is the cause of bug #18685,
which reports that pg_basebackup fails to use ~/.pgpass for
connections [1]. Specifically, it replaced this code:
- keywords[i] = "dbname";
- values[i] = dbname == NULL ? "replication" : dbname;
with this code:
+ keywords[i] = "dbname";
+ values[i] = dbname;
perhaps under the illusion that dbname and connection_string can't
both be NULL. But that ends in passing no dbname to libpq, rather
than passing "replication" which is the correct thing. Apparently
that has no effect on the server connection, but it does break
matching of such connections to ~/.pgpass.
I think the attached will fix it, but I wonder if there are edge
cases I'm not thinking of.
regards, tom lane
Attachment | Content-Type | Size |
---|---|---|
fix-pg_basebackup-pgpass-matching.patch | text/x-diff | 485 bytes |
From: | Jelte Fennema-Nio <me(at)jeltef(dot)nl> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Daniel Gustafsson <daniel(at)yesql(dot)se>, 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:20:59 |
Message-ID: | CAGECzQTwvS_RZi347j2sbUhe2ieaz-tKe=pQu+=h5iftPkSJfQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Mon, 4 Nov 2024 at 18:14, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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).
From: | Daniel Gustafsson <daniel(at)yesql(dot)se> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
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:34:57 |
Message-ID: | 86622C5F-DDA5-46D8-B4CD-99429FA8CA35@yesql.se |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
> On 4 Nov 2024, at 18:14, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> perhaps under the illusion that dbname and connection_string can't
> both be NULL.
Ugh, yes, I failed to capture that nuance.
> I think the attached will fix it, but I wonder if there are edge
> cases I'm not thinking of.
+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?
--
Daniel Gustafsson
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 |
Lists: | Postg토토 꽁 머니SQL |
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 |
From: | Jelte Fennema-Nio <me(at)jeltef(dot)nl> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Daniel Gustafsson <daniel(at)yesql(dot)se>, 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 19:09:32 |
Message-ID: | CAGECzQR++W794q8gRxKZR1FTfB+8uYAdKC8Rn5cQfTOtLdPwgA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Mon, 4 Nov 2024 at 19:57, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> I'm intending to go with the attached.
The new documentation looks good to me, but I think the same change
should be applied to the documentation for pg_receivewal.
From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Jelte Fennema-Nio <me(at)jeltef(dot)nl> |
Cc: | Daniel Gustafsson <daniel(at)yesql(dot)se>, 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 19:18:17 |
Message-ID: | 2881689.1730747897@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
Jelte Fennema-Nio <me(at)jeltef(dot)nl> writes:
> The new documentation looks good to me, but I think the same change
> should be applied to the documentation for pg_receivewal.
Good idea, will do.
regards, tom lane