From: Tom Lane <tgl@sss.pgh.pa.us>
To: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
Cc: Andres Freund <andres@anarazel.de>
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 13:14:34 -0400
Message-ID: <27414.1539018874@sss.pgh.pa.us> (raw)
In-Reply-To: <38e36919-8bee-c717-be99-91137ad28aaf@2ndquadrant.com>
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>
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);
regards, tom lane
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, peter.eisentraut@2ndquadrant.com, andres@anarazel.de, alvherre@2ndquadrant.com, bruce@momjian.us, michael@paquier.xyz
Subject: Re: transction_timestamp() inside of procedures
In-Reply-To: <27414.1539018874@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