pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Rahila Syed <rahilasyed90@gmail.com>
Cc: pgsql-hackers@lists.postgresql.org, Heikki Linnakangas <hlinnaka@iki.fi>
Subject: Re: Fix unsafe coding in ResourceOwnerReleaseAll()
Date: Thu, 25 Jun 2026 01:15:47 -0400
Message-ID: <1062704.1782364547@sss.pgh.pa.us> (raw)
In-Reply-To: <CAH2L28vgFj4kkLNgcMNz85z4k0FXZVOeR7ruLhy_v2Z4sMF7Ow@mail.gmail.com>
References: <646741.1782157515@sss.pgh.pa.us>
	<CAH2L28vgFj4kkLNgcMNz85z4k0FXZVOeR7ruLhy_v2Z4sMF7Ow@mail.gmail.com>

Rahila Syed <rahilasyed90@gmail.com> 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 started", 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





view thread (7+ messages)  latest in thread

Message-ID: <1062704.1782364547@sss.pgh.pa.us>
Permalink:  ../1062704.1782364547@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/1062704.1782364547@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, rahilasyed90@gmail.com, hlinnaka@iki.fi
  Subject: Re: Fix unsafe coding in ResourceOwnerReleaseAll()
  In-Reply-To: <1062704.1782364547@sss.pgh.pa.us>
  References: <646741.1782157515@sss.pgh.pa.us> <CAH2L28vgFj4kkLNgcMNz85z4k0FXZVOeR7ruLhy_v2Z4sMF7Ow@mail.gmail.com> <1062704.1782364547@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox