pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: Bruce Momjian <bruce@momjian.us>
Cc: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
Cc: Michael Paquier <michael@paquier.xyz>
Cc: Andres Freund <andres@anarazel.de>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Subject: Re: transction_timestamp() inside of procedures
Date: Wed, 26 Sep 2018 10:36:01 -0400
Message-ID: <3264.1537972561@sss.pgh.pa.us> (raw)
In-Reply-To: <20180926141336.z7gpojck3tpruqwv@alvherre.pgsql>
References: <20180926141336.z7gpojck3tpruqwv@alvherre.pgsql>

Alvaro Herrera <alvherre@2ndquadrant.com> writes:
> On 2018-Sep-26, Tom Lane wrote:
>> I agree that it would be surprising for transaction timestamp to be newer
>> than statement timestamp.  So for now at least, I'd be satisfied with
>> documenting the behavior.

> Really?  I thought it was practically obvious that for transaction-
> controlling procedures, the transaction timestamp would not necessarily
> be aligned with the statement timestamp.  The surprise would come
> together with the usage of the new feature, so existing users would not
> be surprised in any way.

Nope.  That's the same poor reasoning we've fallen into in some other
cases, of assuming that "the user" is a point source of knowledge.
But DBMSes tend to interact with lots of different code.  If some part
of application A starts using intraprocedure transactions, and then
application B breaks because it wasn't expecting to see xact_start
later than query_start in pg_stat_activity, you've still got a problem.

I'm also a bit hesitant to invent new semantics here based on the
assumption that we've got only one, nonoverlapping, top-level transaction
at a time.  It's not terribly hard to imagine suspend-and-resume-
transaction features coming down the pike at some point.  What will
we do then?  We'll already have a definitional issue for xact_start,
but it'll get worse the more different kinds of xact_start we have.

			regards, tom lane




view thread (32+ messages)  latest in thread

Message-ID: <3264.1537972561@sss.pgh.pa.us>
Permalink:  ../3264.1537972561@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/3264.1537972561@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, alvherre@2ndquadrant.com, bruce@momjian.us, peter.eisentraut@2ndquadrant.com, michael@paquier.xyz, andres@anarazel.de
  Subject: Re: transction_timestamp() inside of procedures
  In-Reply-To: <3264.1537972561@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox