diff --git a/src/backend/replication/logical/worker.c b/src/backend/replication/logical/worker.c index 97d2dff0dd..21a4fea821 100644 --- a/src/backend/replication/logical/worker.c +++ b/src/backend/replication/logical/worker.c @@ -157,12 +157,15 @@ ensure_transaction(void) { if (IsTransactionState()) { + SetCurrentStatementStartTimestamp(); + if (CurrentMemoryContext != ApplyMessageContext) MemoryContextSwitchTo(ApplyMessageContext); return false; } + SetCurrentStatementStartTimestamp(); StartTransactionCommand(); maybe_reread_subscription();