From d3db37bca231beb0081567ef818ac1ec852cbb1a Mon Sep 17 00:00:00 2001 From: Arseny Sher Date: Sat, 17 Feb 2018 04:39:09 +0300 Subject: [PATCH] Start decoding from restart_lsn which definitely exists. --- src/backend/replication/slotfuncs.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/backend/replication/slotfuncs.c b/src/backend/replication/slotfuncs.c index 7302f36488..e7d0ef49bc 100644 --- a/src/backend/replication/slotfuncs.c +++ b/src/backend/replication/slotfuncs.c @@ -472,7 +472,10 @@ pg_replication_slot_advance(PG_FUNCTION_ARGS) /* Acquire the slot so we "own" it */ ReplicationSlotAcquire(NameStr(*slotname), true); - startlsn = MyReplicationSlot->data.confirmed_flush; + if (OidIsValid(MyReplicationSlot->data.database)) + startlsn = MyReplicationSlot->data.restart_lsn; + else + startlsn = MyReplicationSlot->data.confirmed_flush; if (moveto < startlsn) { ReplicationSlotRelease(); -- 2.11.0