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 1lcz9g-0004CM-DF for pgsql-bugs@arkaria.postgresql.org; Sat, 01 May 2021 23:36:12 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lcz9c-00016e-Pq for pgsql-bugs@arkaria.postgresql.org; Sat, 01 May 2021 23:36:08 +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 1lcz9c-00016X-EH for pgsql-bugs@lists.postgresql.org; Sat, 01 May 2021 23:36:08 +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 1lcz9V-0002fx-6Y for pgsql-bugs@lists.postgresql.org; Sat, 01 May 2021 23:36:06 +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 141NZtvV3493687; Sat, 1 May 2021 19:35:56 -0400 From: Tom Lane To: Brar Piening cc: mike.adelson314@gmail.com, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #16988: Spurious "SET LOCAL can only be used in transaction blocks" warning using implicit transaction block In-reply-to: <3a158f8d-708e-ad13-617a-af8349aae4f4@gmx.de> References: <16988-58edba102adb5128@postgresql.org> <3044772.1619712195@sss.pgh.pa.us> <3a158f8d-708e-ad13-617a-af8349aae4f4@gmx.de> Comments: In-reply-to Brar Piening message dated "Sun, 02 May 2021 00:22:44 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3493685.1619912155.1@sss.pgh.pa.us> Date: Sat, 01 May 2021 19:35:55 -0400 Message-ID: <3493686.1619912155@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Brar Piening writes: > Tom Lane wrote: >> PG Bug reporting form writes: >>> I am using SET LOCAL in an Npgsql multi-statement command. >> It seems that whatever Npgsql is doing at the wire protocol level >> doesn't match this, but they'd have to explain what they are doing >> for us to offer much help. > At the wire protocol level npgsql sends this as two queries via the > extended query protocol without a sync inbetween them. > (Parse,Bind,Describe,Execute;Parse,Bind,Describe,Execute,Sync) There is no implicit transaction block around the two commands in such a case, so that explains why it doesn't act as Mike was hoping. Omitting the Sync has zero effect on transactional semantics; it only means that if the first command fails, we'll skip the second one. regards, tom lane