summaryrefslogtreecommitdiff
path: root/src/backend/replication/walsender.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/replication/walsender.c')
-rw-r--r--src/backend/replication/walsender.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/backend/replication/walsender.c b/src/backend/replication/walsender.c
index 59d1dfc7e28..754f505c139 100644
--- a/src/backend/replication/walsender.c
+++ b/src/backend/replication/walsender.c
@@ -440,12 +440,10 @@ IdentifySystem(void)
/* syscache access needs a transaction env. */
StartTransactionCommand();
- /* make dbname live outside TX context */
- MemoryContextSwitchTo(cur);
dbname = get_database_name(MyDatabaseId);
+ /* copy dbname out of TX context */
+ dbname = MemoryContextStrdup(cur, dbname);
CommitTransactionCommand();
- /* CommitTransactionCommand switches to TopMemoryContext */
- MemoryContextSwitchTo(cur);
}
dest = CreateDestReceiver(DestRemoteSimple);