Set statement timestamp in apply worker

This ensures that triggers can see an up-to-date timestamp.

Reported-by: Konstantin Evteev <konst583@gmail.com>
This commit is contained in:
Peter Eisentraut 2017-06-17 08:54:21 -04:00
parent 7f5cb14e3c
commit 033370179a

View File

@ -157,12 +157,15 @@ ensure_transaction(void)
{ {
if (IsTransactionState()) if (IsTransactionState())
{ {
SetCurrentStatementStartTimestamp();
if (CurrentMemoryContext != ApplyMessageContext) if (CurrentMemoryContext != ApplyMessageContext)
MemoryContextSwitchTo(ApplyMessageContext); MemoryContextSwitchTo(ApplyMessageContext);
return false; return false;
} }
SetCurrentStatementStartTimestamp();
StartTransactionCommand(); StartTransactionCommand();
maybe_reread_subscription(); maybe_reread_subscription();