From: Michael Paquier Date: Thu, 24 Nov 2022 07:07:59 +0000 (+0900) Subject: Add the database name to the ps display of logical WAL senders X-Git-Tag: REL_16_BETA1~1243 X-Git-Url: http://git.postgresql.org/gitweb/?a=commitdiff_plain;h=af205152ef57cf54730c38342878cb6b9f8ce7a1;p=postgresql.git Add the database name to the ps display of logical WAL senders Logical WAL senders display now as follows, gaining a database name: postgres: walsender USER DATABASE HOST(PORT) STATE Physical WAL senders show up the same, as of: postgres: walsender USER HOST(PORT) STATE This information was missing, hence it was not possible to know from ps if a WAL sender was a logical or a physical one, and on which database it is connected when it is logical. Author: Tatsuhiro Nakamori Reviewed-by: Fujii Masao, Bharath Rupireddy Discussion: https://postgr.es/m/36a3b137e82e0ea9fe7e4234f03b64a1@oss.nttdata.com --- diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c index c83cc8cc6cd..a8a246921f2 100644 --- a/src/backend/postmaster/postmaster.c +++ b/src/backend/postmaster/postmaster.c @@ -4365,7 +4365,7 @@ BackendInitialize(Port *port) if (am_walsender) appendStringInfo(&ps_data, "%s ", GetBackendTypeDesc(B_WAL_SENDER)); appendStringInfo(&ps_data, "%s ", port->user_name); - if (!am_walsender) + if (port->database_name[0] != '\0') appendStringInfo(&ps_data, "%s ", port->database_name); appendStringInfoString(&ps_data, port->remote_host); if (port->remote_port[0] != '\0')