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.94.2) (envelope-from ) id 1v5Q2K-006Xbp-0p for pgsql-bugs@arkaria.postgresql.org; Sun, 05 Oct 2025 14:48:32 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1v5Q2G-002mMy-6j for pgsql-bugs@arkaria.postgresql.org; Sun, 05 Oct 2025 14:48:29 +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.94.2) (envelope-from ) id 1v5Q2F-002mMi-NK for pgsql-bugs@lists.postgresql.org; Sun, 05 Oct 2025 14:48:28 +0000 Received: from fhigh-b5-smtp.messagingengine.com ([202.12.124.156]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1v5Q2D-000WLT-0M for pgsql-bugs@lists.postgresql.org; Sun, 05 Oct 2025 14:48:27 +0000 Received: from phl-compute-07.internal (phl-compute-07.internal [10.202.2.47]) by mailfhigh.stl.internal (Postfix) with ESMTP id 72B657A0051; Sun, 5 Oct 2025 10:48:23 -0400 (EDT) Received: from phl-imap-05 ([10.202.2.95]) by phl-compute-07.internal (MEProxy); Sun, 05 Oct 2025 10:48:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eulerto.com; h= cc:content-transfer-encoding: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=1759675703; x=1759762103; bh=8aU4kaVxJDJL52m9Hh7rJIUL30nSco0Dr9nDsOc9aQ4=; b= aRPql705UxQyRPvzDuUtgnkAckxUC7tTkpaWYkxZuU+gZ6UJTeAXoF9alv5gmqOC VO/2gxSNTjz1cNyU4hxKUN5L7Q9cml8c8N3gYnhyb3aiTPOqYQJPYEqYtIwDrHuW 5u8CLluD8CHnDgZQjG+aYIPKFVSuFJmIjvGUOzOE7g24X1hYiMYA0H2m9KXF+OBK i2Z0FC6GHN641FfnM0vigUcRgJpqL/pOniBu2SuJtZyTDuuvJ0TiNsit/XVUs3ID OH5Q9V2SgQ3CcArldERRaCojN6yBkoNTvpX+PUwSVTUybMCyHhHRAPvUITAhy5t5 DC+30TgzSPw6U0jn9r8KHA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding: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=fm2; t=1759675703; x=1759762103; bh=8 aU4kaVxJDJL52m9Hh7rJIUL30nSco0Dr9nDsOc9aQ4=; b=TixDXNXDxJXkwZD48 aFu/0MAa/CMcrP1f2xE9yPijRn/6Q4BjeZmHMkq3S9lJGCpxkHEspp1taqgNk98B /jynArU4yEX9CNvPbKRqleckSj+ZU9RxqNXlkDC4CS6uu5UcXpbqAgwJEggmLvq8 BJbAxCoOmaMGjlsJ5bz0Rom8bR3vAfBYE3MzD89MPsMfhAAY2ydi/E9Hf2gFC0Ab ZmUpnKDe5qkQGhmk9P0yxKeQ9Qp78H5Khw57X+oIzAkddZOhU2ueZhkudhachEZx JUdwTGz+o+ONDXB0td9LHsdF9Deddq0hFg3DyZQDgFUN7crY0aUNeI3/1rEmZW4B 30KUg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdeggdelgeelgecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecunecujfgurhepofggfffhvffkjghfufgtgfesthejredtre dttdenucfhrhhomhepfdfguhhlvghrucfvrghvvghirhgrfdcuoegvuhhlvghrsegvuhhl vghrthhordgtohhmqeenucggtffrrghtthgvrhhnpeekvdekudfgffelieffledvkeehje dvueevtdejieejkeelffdtudefueekkeelgfenucffohhmrghinhepvghnthgvrhhprhhi shgvuggsrdgtohhmnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilh hfrhhomhepvghulhgvrhesvghulhgvrhhtohdrtghomhdpnhgspghrtghpthhtohepvddp mhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepphhgshhqlhdqsghughhssehlihhsth hsrdhpohhsthhgrhgvshhqlhdrohhrghdprhgtphhtthhopeifvggssghohhgrnhesqhhq rdgtohhm X-ME-Proxy: Feedback-ID: i0c21471d:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id 3AE6E182007A; Sun, 5 Oct 2025 10:48:22 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface MIME-Version: 1.0 X-ThreadId: ArqZRig7pyvB Date: Sun, 05 Oct 2025 11:47:59 -0300 From: "Euler Taveira" To: webbohan@qq.com, pgsql-bugs@lists.postgresql.org Message-Id: <5b04da16-c2de-464b-8677-9e4991b28e55@app.fastmail.com> In-Reply-To: <19073-93772b97a2f1ecf3@postgresql.org> References: <19073-93772b97a2f1ecf3@postgresql.org> Subject: Re: BUG #19073: there are meaningless code in _SPI_execute_plan() when canSetTag is true Content-Type: text/plain Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Sat, Oct 4, 2025, at 11:29 PM, PG Bug reporting form wrote: > In function _SPI_execute_plan(), `my_tuptable` is local variable and > initialized as NULL. > If plan is canSetTag subqueries, `SPI_freetuptable(my_tuptable)` is > meaningless, because `my_tuptable` is NULL. > We'd better remove this code. > There could be multiple statements. The first case will call SPI_freetuptable() and it is a noop. The code path you are referring to is inside a foreach loop and a previous statement might set my_tuptable and needs to be freed before reusing it. That's exactly what the comment says. /* * The last canSetTag query sets the status values returned to the * caller. Be careful to free any tuptables not returned, to * avoid intra-transaction memory leak. */ if (canSetTag) { my_processed = _SPI_current->processed; SPI_freetuptable(my_tuptable); my_tuptable = _SPI_current->tuptable; my_res = res; } -- Euler Taveira EDB https://www.enterprisedb.com/