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 1o1Xj9-00084C-EZ for pgsql-hackers@arkaria.postgresql.org; Wed, 15 Jun 2022 18:26:51 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1o1Xj7-0003kW-SA for pgsql-hackers@arkaria.postgresql.org; Wed, 15 Jun 2022 18:26:49 +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 1o1Xj6-0003jJ-Uc for pgsql-hackers@lists.postgresql.org; Wed, 15 Jun 2022 18:26:49 +0000 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o1Xj2-0005HC-6M for pgsql-hackers@lists.postgresql.org; Wed, 15 Jun 2022 18:26:48 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id E2CBD3200CD2; Wed, 15 Jun 2022 14:26:37 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Wed, 15 Jun 2022 14:26:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:reply-to:sender :subject:subject:to:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; t=1655317597; x=1655403997; bh=n mqPriTKdAQy1w0+yGsr7Mk6n3ntK4fZCsLn8B2rGNw=; b=T+bI988PcPLJ0OCxe ifIIVEgqY3u0e8jtHsIk3zPa5DGOy723bzX7uoK0HjWw6vlFMhjcadsgyML683dl YHE6C0jckMIPtEbD1yjoUeNMtRV7zhEimBGuXKwt1sSIHDlDbUBINC1Izomp1h9C nuFGzZy9J+Z+FAb1oIAy9i7e/WuZc4gfYusA6lzkoDNihdyWx+flg20TsVg+b66X aWsh5mhqoUqovwkeRFQH+w1KFLdiG7Edn1nNPskufOlzyw1YaWhVo6P8G0uI9jq0 MyINSmMgWt2A8o9WqFwZF8mLuJkG0iAIVSmPRgPaXv52acaWA2kYwM+UBC44GELC uoRNw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedruddvuddguddvudcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhepfffhvfevuffkgggtugfgjgesmh ekreertddtjeenucfhrhhomheptehlvhgrrhhoucfjvghrrhgvrhgruceorghlvhhhvghr rhgvsegrlhhvhhdrnhhoqdhiphdrohhrgheqnecuggftrfgrthhtvghrnhepleefhefgie etffffudefuedvfeegffeujedtheevudehjefgheehvedugffgfeeinecuffhomhgrihhn pehpohhsthhgrhdrvghspdgvnhhtvghrphhrihhsvggusgdrtghomhenucevlhhushhtvg hrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrlhhvhhgvrhhrvgesrghl vhhhrdhnohdqihhprdhorhhg X-ME-Proxy: Feedback-ID: ia2694551:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 15 Jun 2022 14:26:36 -0400 (EDT) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id D162F348; Wed, 15 Jun 2022 20:26:33 +0200 (CEST) Date: Wed, 15 Jun 2022 20:26:33 +0200 From: Alvaro Herrera To: Kyotaro Horiguchi Cc: daniele.varrazzo@gmail.com, pgsql-hackers@lists.postgresql.org Subject: Re: Using PQexecQuery in pipeline mode produces unexpected Close messages Message-ID: <20220615182633.ztcoloh7xbicggot@alvherre.pgsql> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="eq2sy33kqql2cp67" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20220610.152544.1597540405935332165.horikyota.ntt@gmail.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --eq2sy33kqql2cp67 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit On 2022-Jun-10, Kyotaro Horiguchi wrote: > (Moved to -hackers) > > At Wed, 8 Jun 2022 17:08:47 +0200, Alvaro Herrera wrote in > > What that Close message is doing is closing the unnamed portal, which > > is otherwise closed implicitly when the next one is opened. That's how > > single-query mode works: if you run a single portal, it'll be kept open. > > > > I believe that the right fix is to not send that Close message in > > PQsendQuery. > > Agreed. At least Close message in that context is useless and > PQsendQueryGuts doesn't send it. And removes the Close message surely > fixes the issue. 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. I was about to push the attached patch (a merged version of Kyotaro's and mine), but now I'm wondering if that's the right approach. 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.) - Have the server not send CloseComplete at all in the cases where the client is not expecting it. Not sure how this would be implemented. - Other ideas? -- Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/ "That sort of implies that there are Emacs keystrokes which aren't obscure. I've been using it daily for 2 years now and have yet to discover any key sequence which makes any sense." (Paul Thomas) --eq2sy33kqql2cp67 Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v2-0001-PQsendQuery-Don-t-send-Close-in-pipeline-mode.patch"