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 1o1YCF-0000pT-UE for pgsql-hackers@arkaria.postgresql.org; Wed, 15 Jun 2022 18:56:55 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1o1YCE-0003b7-Eo for pgsql-hackers@arkaria.postgresql.org; Wed, 15 Jun 2022 18:56:54 +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 1o1YCE-0003ay-66 for pgsql-hackers@lists.postgresql.org; Wed, 15 Jun 2022 18:56:54 +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 1o1YC6-0005Vf-Fu for pgsql-hackers@lists.postgresql.org; Wed, 15 Jun 2022 18:56:53 +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 25FIugKC532817; Wed, 15 Jun 2022 14:56:42 -0400 From: Tom Lane To: Alvaro Herrera cc: Kyotaro Horiguchi , daniele.varrazzo@gmail.com, pgsql-hackers@lists.postgresql.org Subject: Re: Using PQexecQuery in pipeline mode produces unexpected Close messages In-reply-to: <20220615182633.ztcoloh7xbicggot@alvherre.pgsql> References: <20220615182633.ztcoloh7xbicggot@alvherre.pgsql> Comments: In-reply-to Alvaro Herrera message dated "Wed, 15 Jun 2022 20:26:33 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <532815.1655319402.1@sss.pgh.pa.us> Date: Wed, 15 Jun 2022 14:56:42 -0400 Message-ID: <532816.1655319402@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Alvaro Herrera writes: > So, git archaeology led me to this thread > https://postgr.es/m/202106072107.d4i55hdscxqj@alvherre.pgsql > which is why we added that message in the first place. Um. Good thing you looked. I doubt we want to revert that change now. > Alternatives: > - Have the client not complain if it gets CloseComplete in idle state. > (After all, it's a pretty useless message, since we already do nothing > with it if we get it in BUSY state.) ISTM the actual problem here is that we're reverting to IDLE state too soon. I didn't try to trace down exactly where that's happening, but I notice that in the non-pipeline case we don't go to IDLE till we've seen 'Z' (Sync). Something in the pipeline logic must be jumping the gun on that state transition. regards, tom lane