Re: Have pg_basebackup write "dbname" in "primary_conninfo"?

Поиск
Список
Период
Сортировка
От Kyotaro Horiguchi
Тема Re: Have pg_basebackup write "dbname" in "primary_conninfo"?
Дата
Msg-id 20240221.120424.79274783106518358.horikyota.ntt@gmail.com
обсуждение исходный текст
Ответ на Re: Have pg_basebackup write "dbname" in "primary_conninfo"?  (Robert Haas <robertmhaas@gmail.com>)
Ответы Re: Have pg_basebackup write "dbname" in "primary_conninfo"?  (Ajin Cherian <itsajin@gmail.com>)
Re: Have pg_basebackup write "dbname" in "primary_conninfo"?  (Ajin Cherian <itsajin@gmail.com>)
RE: Have pg_basebackup write "dbname" in "primary_conninfo"?  ("Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com>)
Re: Have pg_basebackup write "dbname" in "primary_conninfo"?  (Amit Kapila <amit.kapila16@gmail.com>)
Список pgsql-hackers
At Tue, 20 Feb 2024 19:56:10 +0530, Robert Haas <robertmhaas@gmail.com> wrote in 
> It seems like maybe somebody should look into why this is happening,
> and perhaps fix it.

GetConnection()@streamutil.c wants to ensure conninfo has a fallback
database name ("replication"). However, the function seems to be
ignoring the case where neither dbname nor connection string is given,
which is the first case Kuroda-san raised. The second case is the
intended behavior of the function.

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

And the function incorrectly assumes that the connection string
requires "dbname=replication".

>     * Merge the connection info inputs given in form of connection string,
>     * options and default values (dbname=replication, replication=true, etc.)

But the name is a pseudo database name only used by pg_hba.conf
(maybe) , which cannot be used as an actual database name (without
quotation marks, or unless it is actually created). The function
should not add the fallback database name because the connection
string for physical replication connection doesn't require the dbname
parameter. (attached patch)

About the proposed patch, pg_basebackup cannot verify the validity of
the dbname. It could be problematic.

Although I haven't looked the original thread, it seems that the
dbname is used only by pg_sync_replication_slots(). If it is true,
couldn't we make the SQL function require a database name to make a
connection, instead of requiring it in physical-replication conninfo?

regards.

-- 
Kyotaro Horiguchi
NTT Open Source Software Center

Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: "Hayato Kuroda (Fujitsu)"
Дата:
Сообщение: RE: Have pg_basebackup write "dbname" in "primary_conninfo"?
Следующее
От: shveta malik
Дата:
Сообщение: 'Shutdown <= SmartShutdown' check while launching processes in postmaster.