Why not use dbname parameter in pgut_connection_replication()?
Opened this issue · 2 comments
Hi,
I find that the pgut_connection_replication() function passes the name parameter, which is only used in elog(). The connection string uses replication as the connection database.
It seems the elog's message is incorrect if the connection is failed. Why not use dbname as the connection database?
Physical replication connection connects to the whole server, not a database. Therefore server ignores it: https://github.com/postgres/postgres/blob/REL_16_4/src/backend/postmaster/postmaster.c#L2318
This code was based on pg_basebackup's streamutil where back then it did exactly the same: https://github.com/postgres/postgres/blob/REL9_3_STABLE/src/bin/pg_basebackup/streamutil.c#L94
@fukanchik Thank you for the explanation. IIUC, the pgut_connect_replication() is only used for physical replication, so the dbname has no means, maybe we can remove this parameter, and modify the elog() as following:
elog(strict ? ERROR : WARNING, "could not connect to server: %s", PQerrorMessage(tmpconn));