Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sTOEw-00Fkmk-7N for pgsql-bugs@arkaria.postgresql.org; Mon, 15 Jul 2024 16:07:50 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1sTOEs-00BFXO-Sn for pgsql-bugs@arkaria.postgresql.org; Mon, 15 Jul 2024 16:07:46 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sTOEs-00BFXG-KI for pgsql-bugs@lists.postgresql.org; Mon, 15 Jul 2024 16:07:46 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sTOEp-002GIB-5B for pgsql-bugs@lists.postgresql.org; Mon, 15 Jul 2024 16:07: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 46FG7eGx3167933; Mon, 15 Jul 2024 12:07:40 -0400 From: Tom Lane To: dzja112@gmail.com cc: pgsql-bugs@lists.postgresql.org Subject: Re: BUG #18531: err when using 'current of' with incremental COMMIT In-reply-to: <18531-c6dddd33b8555fd2@postgresql.org> References: <18531-c6dddd33b8555fd2@postgresql.org> Comments: In-reply-to PG Bug reporting form message dated "Tue, 09 Jul 2024 11:00:29 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3167931.1721059660.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Mon, 15 Jul 2024 12:07:40 -0400 Message-ID: <3167932.1721059660@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk PG Bug reporting form writes: > That combine 'current of' and 'commit' at one loop is bad idea? Yeah, that's not going to work. The first COMMIT auto-holds the cursor [1], and after that there is not an active cursor query for the WHERE CURRENT OF to refer to. Even if that data were somehow retained, the COMMIT would have dropped the tuple locks taken by the cursor query, so that the semantics would be a lot squishier than you'd want. The discussion at [1] fails to mention that there are any such gotchas implicit in the auto-hold behavior, so I added a little bit of text [2]. regards, tom lane [1] https://www.postgresql.org/docs/current/plpgsql-transactions.html [2] https://git.postgresql.org/gitweb/?p=3Dpostgresql.git;a=3Dcommitdiff;h= =3Da0899c0a97d19b0c330ff885af4b78b3e7efb100