Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1g3Ifm-0001iP-JJ for pgsql-hackers@arkaria.postgresql.org; Fri, 21 Sep 2018 10:28:30 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1g3Ifj-0007yB-HD for pgsql-hackers@arkaria.postgresql.org; Fri, 21 Sep 2018 10:28:27 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1g3Ifj-0007y4-7J for pgsql-hackers@lists.postgresql.org; Fri, 21 Sep 2018 10:28:27 +0000 Received: from momjian.us ([72.94.173.45]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1g3Ifg-0004Kn-EF for pgsql-hackers@postgresql.org; Fri, 21 Sep 2018 10:28:25 +0000 Received: from bruce by momjian.us with local (Exim 4.84_2) (envelope-from ) id 1g3Ife-0006CR-N8; Fri, 21 Sep 2018 06:28:22 -0400 Date: Fri, 21 Sep 2018 06:28:22 -0400 From: Bruce Momjian To: Michael Paquier Cc: Andres Freund , PostgreSQL-development Subject: Re: transction_timestamp() inside of procedures Message-ID: <20180921102822.GA22699@momjian.us> References: <20180920234040.GC29981@momjian.us> <20180921045536.GJ1338@paquier.xyz> <20180921051206.bzfiew4nthmunpbj@alap3.anarazel.de> <20180921053425.GM1338@paquier.xyz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180921053425.GM1338@paquier.xyz> User-Agent: Mutt/1.5.23 (2014-03-12) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Fri, Sep 21, 2018 at 02:34:25PM +0900, Michael Paquier wrote: > On Thu, Sep 20, 2018 at 10:12:06PM -0700, Andres Freund wrote: > > Isn't the point that transaction_timestamp() does *not* currently change > > its value, even though the transaction (although not the outermost > > statement) has finished? > > Ouch, yes. I see the point now. Indeed that's strange to not have a > new transaction timestamp after commit within the DO block.. So, this puts us in an odd position. Right now everyone knows that statement_timestamp() is only changed by the outer statement, i.e., a SELECT in a function doesn't change statement_timestamp(). So, there is an argument that transaction_timestamp() should do the same and not change in a function --- in fact, if it does change, it would mean that transaction_timestamp() changes in a function, but statement_timestamp() doesn't --- that seems very odd. It would mean that new statements in a function don't change statement_timestamp(), but new transctions in a function do --- again, very odd. -- Bruce Momjian http://momjian.us EnterpriseDB http://enterprisedb.com + As you are, so once was I. As I am, so you will be. + + Ancient Roman grave inscription +