postgres.git / summary / log / commit / refs

commit    033370179a6d15b2e1b519462d14419d6dc84e73
Author:   Peter Eisentraut <peter_e@gmx.net>
Date:     Sat Jun 17 12:54:21 2017 +0000
First released in: 10.0

    Set statement timestamp in apply worker
    
    This ensures that triggers can see an up-to-date timestamp.
    
    Reported-by: Konstantin Evteev <konst583@gmail.com>


src/backend/replication/logical/worker.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/backend/replication/logical/worker.c b/src/backend/replication/logical/worker.c index 97d2dff0dd3..21a4fea821d 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(); [parent: 7f5cb14e3c50]