Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why not use dbname parameter in pgut_connection_replication()? #634

Open
japinli opened this issue Aug 28, 2024 · 2 comments
Open

Why not use dbname parameter in pgut_connection_replication()? #634

japinli opened this issue Aug 28, 2024 · 2 comments

Comments

@japinli
Copy link
Contributor

japinli commented Aug 28, 2024

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?

@fukanchik
Copy link

fukanchik commented Aug 28, 2024

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

@japinli
Copy link
Contributor Author

japinli commented Aug 28, 2024

@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));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@fukanchik @japinli and others