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 1oIdms-0002xn-UM for pgsql-bugs@arkaria.postgresql.org; Mon, 01 Aug 2022 22:21:22 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oIdmr-0006ob-OV for pgsql-bugs@arkaria.postgresql.org; Mon, 01 Aug 2022 22:21:21 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oIdmr-0006oR-G0 for pgsql-bugs@lists.postgresql.org; Mon, 01 Aug 2022 22:21:21 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oIdmp-0002o3-3s for pgsql-bugs@lists.postgresql.org; Mon, 01 Aug 2022 22:21:20 +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 271MLIAR2185027; Mon, 1 Aug 2022 18:21:18 -0400 From: Tom Lane To: matt.jibson@gmail.com cc: pgsql-bugs@lists.postgresql.org Subject: Re: BUG #17565: Extended query protocol incorrectly sets TBLOCK_STARTED even though multiple queries can be executed In-reply-to: <17565-156f3bd8f262150f@postgresql.org> References: <17565-156f3bd8f262150f@postgresql.org> Comments: In-reply-to PG Bug reporting form message dated "Mon, 01 Aug 2022 20:12:00 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2185025.1659392478.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Mon, 01 Aug 2022 18:21:18 -0400 Message-ID: <2185026.1659392478@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: > The extended query protocol is most often used with the 4 messages in th= e > sequence: Parse, Bind, Execute, Sync. Parse, Bind, and Execute all call > start_xact_command, which will change blockState to TBLOCK_STARTED. Howe= ver > it is within the protocol spec to instead do: Parse, Bind, Execute, Pars= e, > Bind, Execute, Sync. That is: issue two query executions and then a Sync= . > The Npgsql driver does exactly this at its startup. > The doc comment for TBLOCK_STARTED says "running single-query transactio= n", > but this is a case where a driver can escape that restriction which is > assumed by the rest of the code. For example, there are various things > differentiate between STARTED and INPROGRESS or IMPLICIT_INPROGRESS: > PreventInTransactionBlock, IsInTransactionBlock. Some statements (VACUUM= , > DISCARD ALL) use those functions to prevent their execution in a multi > statement context, but those can be escaped using the extended protocol. Hmmm ... I think this is a duplicate of a bug that we just fixed last week. Please see https://www.postgresql.org/message-id/flat/17434-d9f7a064ce2a88a3%40postgr= esql.org https://git.postgresql.org/gitweb/?p=3Dpostgresql.git&a=3Dcommitdiff&h=3Df= 92944137 and let us know (preferably on that thread) if you think there's still more to do. regards, tom lane