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 1jQck6-0003PC-Ca for pgsql-bugs@arkaria.postgresql.org; Mon, 20 Apr 2020 20:10:10 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jQck5-0000Ma-5L for pgsql-bugs@arkaria.postgresql.org; Mon, 20 Apr 2020 20:10:09 +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 1jQck4-0000MT-VW for pgsql-bugs@lists.postgresql.org; Mon, 20 Apr 2020 20:10:08 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jQck2-0000jR-BQ for pgsql-bugs@lists.postgresql.org; Mon, 20 Apr 2020 20:10:08 +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 03KKA3q6007727; Mon, 20 Apr 2020 16:10:03 -0400 From: Tom Lane To: John Muehlhausen cc: "David G. Johnston" , "pgsql-bugs@lists.postgresql.org" Subject: Re: NOTIFY in multi-statement PQexec() not sent outside of transaction In-reply-to: References: <14161.1587411720@sss.pgh.pa.us> Comments: In-reply-to John Muehlhausen message dated "Mon, 20 Apr 2020 14:56:33 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <7725.1587413403.1@sss.pgh.pa.us> Date: Mon, 20 Apr 2020 16:10:03 -0400 Message-ID: <7726.1587413403@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk John Muehlhausen writes: > My perspective as a libpq user is that multi-statement PQexec() should have > the same effects as multiple PQexec() calls other than for the former > dropping the results of all but the most recent statement. Well, that's not even close to true, because of the rules about statements within a multi-statement string getting merged into single transactions. > As a practical matter, what I was trying to do is signal a test case that > Postgres is in the middle of processing a transaction string. I'm not really sure why you want to go about that in this particular way; under ordinary circumstances the client app wouldn't see the notify until after PQexec returned, anyway. (Yes, I realize that there are ways around that, but still, you can't really do anything with the connection until PQexec returns.) Perhaps you could achieve a similar effect using single-row mode, ie break the connection after collecting a few rows from a multi-row query? That's not PQexec at all of course, but if you use PQsendQuery then the server doesn't know the difference. regards, tom lane