Re: transction_timestamp() inside of procedures

Daniel Verite <daniel@manitou-mail.org>

From: "Daniel Verite" <daniel@manitou-mail.org>
To: "Tom Lane" <tgl@sss.pgh.pa.us>
Cc: "Bruce Momjian" <bruce@momjian.us>,"Peter Eisentraut" <peter.eisentraut@2ndquadrant.com>,"Michael Paquier" <michael@paquier.xyz>,"Andres Freund" <andres@anarazel.de>,"PostgreSQL-development" <pgsql-hackers@postgresql.org>
Date: 2018-09-26T19:23:58Z
Lists: pgsql-hackers
	Tom Lane wrote:

> I agree that it would be surprising for transaction timestamp to be newer
> than statement timestamp. 

To me it's more surprising to start a new transaction and having
transaction_timestamp() still pointing at the start of a previous 
transaction.
This feels like a side-effect of being spawned by a procedure,
and an exception to what transaction_timestamp() normally means
or meant until now.

OTOH transaction_timestamp() being possibly newer than
statement_timestamp() seems like a normal consequence of
transactions being created intra-statement.

+1 for transaction_timestamp() and pg_stat_activity being updated
to follow intra-procedure transactions.


Best regards,
-- 
Daniel Vérité
PostgreSQL-powered mailer: http://www.manitou-mail.org
Twitter: @DanielVerite


Commits

  1. Advance transaction timestamp for intra-procedure transactions.