The logical replication code is supposed to use the subscription name as
the fallback_application_name, but in some cases it uses the slot name,
which could be different.  See attached patch to correct this.

-- 
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
From d134d4eae3bd176e10e418746202e69e3f6e7e28 Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <pete...@gmx.net>
Date: Mon, 5 Jun 2017 22:14:40 -0400
Subject: [PATCH] Consistently use subscription name as application name

---
 src/backend/replication/logical/tablesync.c | 2 +-
 src/backend/replication/logical/worker.c    | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/backend/replication/logical/tablesync.c 
b/src/backend/replication/logical/tablesync.c
index 6e268f3521..e8540f291c 100644
--- a/src/backend/replication/logical/tablesync.c
+++ b/src/backend/replication/logical/tablesync.c
@@ -800,7 +800,7 @@ LogicalRepSyncTableStart(XLogRecPtr *origin_startpos)
                                                MySubscription->oid,
                                                MyLogicalRepWorker->relid);
 
-       wrconn = walrcv_connect(MySubscription->conninfo, true, slotname, &err);
+       wrconn = walrcv_connect(MySubscription->conninfo, true, 
MySubscription->name, &err);
        if (wrconn == NULL)
                ereport(ERROR,
                                (errmsg("could not connect to the publisher: 
%s", err)));
diff --git a/src/backend/replication/logical/worker.c 
b/src/backend/replication/logical/worker.c
index a570900a42..b87b6921c0 100644
--- a/src/backend/replication/logical/worker.c
+++ b/src/backend/replication/logical/worker.c
@@ -1595,7 +1595,7 @@ ApplyWorkerMain(Datum main_arg)
                origin_startpos = replorigin_session_get_progress(false);
                CommitTransactionCommand();
 
-               wrconn = walrcv_connect(MySubscription->conninfo, true, 
myslotname,
+               wrconn = walrcv_connect(MySubscription->conninfo, true, 
MySubscription->name,
                                                                &err);
                if (wrconn == NULL)
                        ereport(ERROR,
-- 
2.13.1

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to