Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vIbML-00738Z-1u for pgsql-hackers@arkaria.postgresql.org; Mon, 10 Nov 2025 23:31:40 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vIbMJ-003Ble-18 for pgsql-hackers@arkaria.postgresql.org; Mon, 10 Nov 2025 23:31:39 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vIbMJ-003BlW-09 for pgsql-hackers@lists.postgresql.org; Mon, 10 Nov 2025 23:31:39 +0000 Received: from fhigh-b1-smtp.messagingengine.com ([202.12.124.152]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vIbMG-0073zx-26 for pgsql-hackers@lists.postgresql.org; Mon, 10 Nov 2025 23:31:38 +0000 Received: from phl-compute-06.internal (phl-compute-06.internal [10.202.2.46]) by mailfhigh.stl.internal (Postfix) with ESMTP id 1FF247A00B1; Mon, 10 Nov 2025 18:31:35 -0500 (EST) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-06.internal (MEProxy); Mon, 10 Nov 2025 18:31:35 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm3; t=1762817494; x=1762903894; bh=pzc3TwIww4 DfRYid42gRu+esgqMmI7Bbt/tqpjnEta0=; b=AWLjmvUxdj7q+b8eze2HN5WqT6 QQ1h9zmR4GIM5dDdHGfVRuM95KjrbkmjavLypjjKeT5D/+ZpKfiCVmNigkqV4CkE 0lJXe/aIKcFYA2Jg6DLcZnmIr6KzllQzJBKrkCtuEBgRvrz0EXu1q2RKm2AxL3mQ j/gF/APtNXvg4dnxmvRDWxO/3FopzfNJWMvJsgMn2zQdL63UYBm0d1ej76F0Yr+d 3udwEdZQUy7NoobrW5HJFqdOOUVhVc1wyNSMOQt8EjTgExwCMIUUhtNAcu+SjijU uNZAqnCySQXrLgxYf6jcJ/PV2Bv7w3EeCRmh1nZNXT7cvtBHDkDKRJLYwByw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t= 1762817494; x=1762903894; bh=pzc3TwIww4DfRYid42gRu+esgqMmI7Bbt/t qpjnEta0=; b=sA6nxYH0O9ymTLLLoL2ZhyN2BFydJY8YDI/MTbHmI9s/DXYHgld lDwe6kKqj/FzOLNsN+U5S3ywklG1FaymQSZUohPybGN1OzA+rOA9i1+HARYKNWHS CTRmXAzZ7Yjz7YASc2ITEruKH1XQwc6ylMS8M5KsWcxPHz8pftlqHiZu4xzSILAU RMwh3Ds3ZS7NI/sMBQRmDxHM1hEv+cLE/OTOMV5tAWQHdy3TVx0FqO26SMMi/AFo 9hkujrh68NMiYSQ1v9fkvFbs7IqsEYgqPVVI0P6cfBrZDFcNhFHKNUrmsUEdqL6r DIwUjhHEmk/2yBNsNpLtl0uiruBflGy4IGg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdeggdduleelieegucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnegfrh hlucfvnfffucdljedtmdenucfjughrpeffhffvvefukfhfgggtuggjsehgtderredttddv necuhfhrohhmpefoihgthhgrvghlucfrrghquhhivghruceomhhitghhrggvlhesphgrqh huihgvrhdrgiihiieqnecuggftrfgrthhtvghrnhepteelieefudffhffhtdetleeggeeg fffhkeeuveetiefgudduvedutefggeeivdejnecuvehluhhsthgvrhfuihiivgeptdenuc frrghrrghmpehmrghilhhfrhhomhepmhhitghhrggvlhesphgrqhhuihgvrhdrgiihiidp nhgspghrtghpthhtohepfedpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepthhglh esshhsshdrphhghhdrphgrrdhushdprhgtphhtthhopehrohgsvghrthhmhhgrrghssehg mhgrihhlrdgtohhmpdhrtghpthhtohepphhgshhqlhdqhhgrtghkvghrsheslhhishhtsh drphhoshhtghhrvghsqhhlrdhorhhg X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 10 Nov 2025 18:31:33 -0500 (EST) Date: Tue, 11 Nov 2025 08:31:26 +0900 From: Michael Paquier To: Tom Lane Cc: Robert Haas , PostgreSQL Hackers Subject: Re: pgsql: Drop unnamed portal immediately after execution to completion Message-ID: References: <1982325.1762810082@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="TQDVnsVF08Ez+LXT" Content-Disposition: inline In-Reply-To: <1982325.1762810082@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --TQDVnsVF08Ez+LXT Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Mon, Nov 10, 2025 at 04:28:02PM -0500, Tom Lane wrote: > Robert Haas writes: >> This patch doesn't look well-considered to me. One problem is that >> it's a wire protocol change to fix a minor logging anomaly, which >> seems disproportionate. Another problem is that the new portal-drop >> behavior is conditional on whether XACT_FLAGS_NEEDIMMEDIATECOMMIT gets >> set, which seems unprincipled. In addition to those points, I am not >> entirely certain that the "here is no need for it beyond this point" >> comment is correct. I mean, I think it will normally be true, but what >> if the client wants to send a Describe message after-the-fact, or an >> additional Execute message that will presumably return zero rows? > > Yeah, the whole idea of changing the wire-level behavior to fix this > has been making me itch: I don't believe for a moment that it won't > cause compatibility problems. > > I do not have a better proposal for fixing the problem though. All the other solutions mentioned mean to work around the issue of the unnamed portal still being present by maintaining the query string it in a different context across multiple messages. And I doubt that anybody would be thrilled by that. If you think that we should continue to live with the protocol for unnamed portals as-is and continue to live with the existing behavior, meaning a revert of 1fd981f05369, that would not be the end of the world here: we'd still have some tests that track the past-and-currently-released behavior. Even if strange, it works with the timing where the unnamed protocol is dropped. Perhaps somebody would be able to come up with a approach better than a more aggressive portal drop once completed, but I don't quite see how much can be done as long as we manipulate the unnamed portals this way (aka drop then with a follow-up bind, and expect the logging to show the correct statements attached to a previous message that we have no knowledge about). The original statement logging did not really consider all these fancier cases with the extended query protocol. -- Michael --TQDVnsVF08Ez+LXT Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmkSdc4ACgkQnvQgOdby QH3MYQ/8DxYdqsM9W7Je+d6wlKl3PKArfKfY47AxbGXirCNdz5qm7r9wJmnRY5Xl vsxA0PFgzzwjLaybPy9kOau9idW4J0Rw2mhyR6PuK0mpDrZ3JWNsrwjzZOFvUVBs 9fZCQaM9stFG5Mbh5owc3dG0ssg1qIkAbq7OpiLDpDYdWJPqBQvX7Y9sQxwde6f5 rbdfUYdyePe7k04aBvDxIAlTZKOh0prktq9OsVGkPqj7n9X83dj+g1RkxMS2GslL rYJu4Lg13/E0YJpUFNLIKyLfsamVKswfdwhXc1n7qt5OpwP9JeOGwGiu6/r0ELiM caOlxTVehV8WNAf0bPG3p6zgJS+Ku7OO+7SBw86w3L3kXizAzFJXj0rCEuXvMjsL 9N422QX7FZykUsY3fa7EWuLfcfCt2XeqPbHZdXdptgI1H/X3I6zWqT1ii+YQJFcA UlqAx88IvjsZXIow/RL8DXgM+Rn7jCUw8Xe1HNCNa7wzNcwWkO4aXzq0BITcGGi7 u8A0qXf59EfuFUIqTuqhAZk2785Wj9/LC52vJ7KiKVDg16lJ9I40Ll0En6aCcn1h q3m6RmpFJeTR6Sr/byO8NzrzO7qfCMscu3uzbypF86wgS6ftUGw8m1pI5TCagXen QeQCUJN0DzLszs92dHjZpDEFPW0vXMfIh95LqxfFG/8lksFRGPI= =S7Cu -----END PGP SIGNATURE----- --TQDVnsVF08Ez+LXT--