Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mUwUa-0003SD-SL for pgsql-general@arkaria.postgresql.org; Mon, 27 Sep 2021 19:40:48 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mUwUY-0008V4-1S for pgsql-general@arkaria.postgresql.org; Mon, 27 Sep 2021 19:40:46 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mUwUX-0008Uw-Or for pgsql-general@lists.postgresql.org; Mon, 27 Sep 2021 19:40:45 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mUwUU-0006lG-VK for pgsql-general@lists.postgresql.org; Mon, 27 Sep 2021 19:40:45 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 18RJedfO2767394; Mon, 27 Sep 2021 15:40:39 -0400 From: Tom Lane To: Christophe Pettus cc: "pgsql-generallists.postgresql.org" Subject: Re: statement_timeout vs DECLARE CURSOR In-reply-to: References: Comments: In-reply-to Christophe Pettus message dated "Mon, 27 Sep 2021 11:10:19 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2767392.1632771639.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Mon, 27 Sep 2021 15:40:39 -0400 Message-ID: <2767393.1632771639@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Christophe Pettus writes: >> On Sep 27, 2021, at 10:42, Christophe Pettus wrote: >> We've encountered some unexpected behavior with statement_timeout not c= ancelling a query in DECLARE CURSOR, but only if the DECLARE CURSOR is out= side of a transaction: > A bit more poking revealed the reason: The ON HOLD cursor's query is exe= cuted at commit time (which is, logically, not interruptible), but that's = all wrapped in the single statement outside of a transaction. Hmm ... seems like a bit of a UX failure. I wonder why we don't persist such cursors before we get into the uninterruptible part of COMMIT. regards, tom lane