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 1wccRV-003UVn-2X for pgsql-hackers@arkaria.postgresql.org; Thu, 25 Jun 2026 05:16:01 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wccRU-003n3V-29 for pgsql-hackers@arkaria.postgresql.org; Thu, 25 Jun 2026 05:16:00 +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 1wccRU-003n3M-1F for pgsql-hackers@lists.postgresql.org; Thu, 25 Jun 2026 05:16:00 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wccRO-0000000094e-3w89 for pgsql-hackers@lists.postgresql.org; Thu, 25 Jun 2026 05:16:00 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.18.1/8.18.1) with ESMTP id 65P5Fllo1062705; Thu, 25 Jun 2026 01:15:47 -0400 From: Tom Lane To: Rahila Syed cc: pgsql-hackers@lists.postgresql.org, Heikki Linnakangas Subject: Re: Fix unsafe coding in ResourceOwnerReleaseAll() In-reply-to: References: <646741.1782157515@sss.pgh.pa.us> Comments: In-reply-to Rahila Syed message dated "Thu, 25 Jun 2026 12:49:36 +0800" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1062703.1782364547.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Thu, 25 Jun 2026 01:15:47 -0400 Message-ID: <1062704.1782364547@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Rahila Syed writes: > Unrelated to the patch but I noticed a typo in the ERROR message in > ResourceOwnerReleaseAllOfKind(). >> /* Mustn't call this after we have already started releasing resources.= */ >> if (owner->releasing) >> elog(ERROR, "ResourceOwnerForget called for %s after release starte= d", kind->name); Hmm, that definitely looks like a message that was transposed from someplace else without much thought. It might be worth tracing the git history to see how it got to be like that. More: unless I'm missing something, ResourceOwnerReleaseAllOfKind is called only from plancache.c's ReleaseAllPlanCacheRefsInOwner, which is called only in some very random-looking ways in plpgsql. I wonder whether there's not a bigger cleanup project indicated here. When I posted before, I thought that ResourceOwnerReleaseAllOfKind had a direct lineage to the old ResourceOwner code, but now I'm thinking maybe it shouldn't exist at all. Why should plpgsql be taking special care for particular kinds of resource entries, and why should it suppose that it owns all instances of that kind within that resowner? regards, tom lane