From: Andres Freund <andres@anarazel.de>
To: pgsql-hackers@lists.postgresql.org,Tom Lane <tgl@sss.pgh.pa.us>
To: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Cc: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: Bruce Momjian <bruce@momjian.us>
Cc: Michael Paquier <michael@paquier.xyz>
Subject: Re: transction_timestamp() inside of procedures
Date: Mon, 08 Oct 2018 10:24:56 -0700
Message-ID: <E28DF5C1-E2EB-49D6-AC94-AC5FB99E58CF@anarazel.de> (raw)
In-Reply-To: <27414.1539018874@sss.pgh.pa.us>
References: <20180926155443.u4zh7jactzflys3z@alvherre.pgsql>
<ec816bd0-0357-23a9-bea2-3ef1619eb340@2ndquadrant.com>
<e2ad8aaf-e1d8-499e-4de0-e3616f8d908d@2ndquadrant.com>
<20181002145853.wvhcb7pbrzgjyxns@alap3.anarazel.de>
<38e36919-8bee-c717-be99-91137ad28aaf@2ndquadrant.com>
<27414.1539018874@sss.pgh.pa.us>
Hi,
On October 8, 2018 10:14:34 AM PDT, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>Peter Eisentraut <peter.eisentraut@2ndquadrant.com> writes:
>> On 02/10/2018 16:58, Andres Freund wrote:
>>> It's a bit weird to make this decision based on these two timestamps
>>> differing. For one, it only indirectly seems to be guaranteed that
>>> xactStartTimestamp is even set to anything here (to 0 by virtue of
>being
>>> a global var).
>
>> Maybe but it seems to be the simplest way without doing major surgery
>to
>> all this code.
>
>This patch doesn't apply over 07ee62ce9. Also, I like the
>timestamp-comparison approach even less than Andres does: I think it's
>probably outright broken, especially since it treats the equality case
>as license to advance xactStartTimestamp.
>
>Surely there is some way that we can directly test whether we're inside
>a
>procedure or not? I think the logic should be basically
>
> if (!IsParallelWorker())
>+ {
>+ if (!InsideProcedure())
> xactStartTimestamp = stmtStartTimestamp;
>+ else
>+ xactStartTimestamp = GetCurrentTimestamp();
>+ }
> else
> Assert(xactStartTimestamp != 0);
Seems more reasonable from here.
Andres
--
Sent from my Android device with K-9 Mail. Please excuse my brevity.
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: andres@anarazel.de, tgl@sss.pgh.pa.us, peter.eisentraut@2ndquadrant.com, alvherre@2ndquadrant.com, bruce@momjian.us, michael@paquier.xyz
Subject: Re: transction_timestamp() inside of procedures
In-Reply-To: <E28DF5C1-E2EB-49D6-AC94-AC5FB99E58CF@anarazel.de>
* 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