Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iNhi0-0007bT-D2 for pgsql-bugs@arkaria.postgresql.org; Thu, 24 Oct 2019 18:19:40 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iNhhy-00066G-FA for pgsql-bugs@arkaria.postgresql.org; Thu, 24 Oct 2019 18:19:38 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iNhhy-000668-3w for pgsql-bugs@lists.postgresql.org; Thu, 24 Oct 2019 18:19:38 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1iNhhu-0002Jm-FO for pgsql-bugs@lists.postgresql.org; Thu, 24 Oct 2019 18:19:36 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id x9OIJTvk014851; Thu, 24 Oct 2019 14:19:29 -0400 From: Tom Lane To: Tatsuo Ishii cc: rmohite@xento.com, pgsql-bugs@lists.postgresql.org, andres@anarazel.de Subject: Re: BUG #16035: STATEMENT_TIMEOUT not working when we have single quote usage inside CTE which is used in inner sql In-reply-to: <17741.1571698925@sss.pgh.pa.us> References: <16035-456e6e69ebfd4374@postgresql.org> <32454.1570114306@sss.pgh.pa.us> <20191004.171008.1513496013929254081.t-ishii@sraoss.co.jp> <20191006.162220.1257531585774510977.t-ishii@sraoss.co.jp> <17741.1571698925@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Mon, 21 Oct 2019 19:02:05 -0400" MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0" Content-ID: <14785.1571941082.0@sss.pgh.pa.us> Date: Thu, 24 Oct 2019 14:19:29 -0400 Message-ID: <14850.1571941169@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk ------- =_aaaaaaaaaa0 Content-Type: text/plain; charset="us-ascii" Content-ID: <14785.1571941082.1@sss.pgh.pa.us> I wrote: > Tatsuo Ishii writes: >> With attached patch (against master), SET STATEMENT_TIMEOUT >> immediately affects to subsequent commands in the multi statement. I >> think this is not only more intuitive than v10's behavior but it meets >> the original reporter's expectation. > Hm. So, okay, that is a nicer API probably, but note that it also > has the effect that the timeout starts over again for each statement > in the string, while before it applied to the string as a whole. > Are we okay with that change? (I've not yet looked to see if it's > documented anywhere that it works that way...) It's kind of tossing > some of the optimization intended by f8e5f156b overboard, since when > a timeout is active we'll be doing timeout calculations for each > statement in the string. I looked around, and as far as I can tell, there is no detail at all about this in our user-facing docs. I think we should apply a doc patch more or less like the attached. This fails to provide a complete spec of what the behavior used to be, but I don't much care to try to document that 100% exactly. Anyone have an objection to pushing ahead with this for HEAD only? regards, tom lane ------- =_aaaaaaaaaa0 Content-Type: text/x-diff; name="0003-stmt-timeout-docs.patch"; charset="us-ascii" Content-ID: <14785.1571941082.2@sss.pgh.pa.us> Content-Description: 0003-stmt-timeout-docs.patch Content-Transfer-Encoding: quoted-printable diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml index 886632f..26ef8ff 100644 --- a/doc/src/sgml/config.sgml +++ b/doc/src/sgml/config.sgml @@ -7592,11 +7592,25 @@ COPY postgres_log FROM '/full/path/to/logfile.csv'= WITH csv; - Abort any statement that takes more than the specified duration - (defaults to milliseconds), starting from the time the command ar= rives at the server - from the client. If log_min_error_statement i= s set to - ERROR or lower, the statement that timed out w= ill also be - logged. A value of zero (the default) turns this off. + Abort any statement that takes more than the specified duration. + If log_min_error_statement is set + to ERROR or lower, the statement that timed ou= t + will also be logged. + If the value is specified as a plain number, it is measured in + milliseconds by default. + A value of zero (the default) disables the timeout. + + + + The timeout is measured from the time a command arrives at the + server until it is completed by the server. If multiple SQL + statements appear in a single simple-Query message, the timeout + is applied to each statement separately. + (PostgreSQL versions before 13 usually + treated the timeout as applying to the whole query string.) + In extended query protocol, the timeout starts running when any + query-related message (Parse, Bind, Execute, Describe) arrives, a= nd + it is cancelled by completion of an Execute or Sync message. = ------- =_aaaaaaaaaa0--