Re: BUG #19026: ResourceOwnerForget can't find owner for invalid plancache - Mailing list pgsql-bugs

From Kirill Reshke
Subject Re: BUG #19026: ResourceOwnerForget can't find owner for invalid plancache
Date
Msg-id CALdSSPhMfackgEn+8vc9N-9eSoSPSrQKUgJFdka2oXDd5Xzwvw@mail.gmail.com
Whole thread Raw
In response to Re: BUG #19026: ResourceOwnerForget can't find owner for invalid plancache  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
On Wed, 20 Aug 2025 at 21:57, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> The reason this broke at 0313c5dc6 is that that enabled
> SQLFunctionCaches to be re-used for the life of the associated
> FmgrInfo, and when we are talking about an opclass support procedure,
> that FmgrInfo is in the relcache so it is likely to last for the
> life of the session.  So the presented test case causes us to error
> out of execution of the SQL function during the first INSERT, but
> its SQLFunctionCache still exists and has fcache->cplan != NULL,
> even though error cleanup would've released the reference count
> already.  When we come back to this point in the second INSERT,
> init_execution_state is fooled into trying to release the
> already-released cplan.

Thank you for this explanation. I understood how things got buggy and
how they should be fixed.
The v3 LGTM.

-- 
Best regards,
Kirill Reshke



pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #19026: ResourceOwnerForget can't find owner for invalid plancache
Next
From: Peter Geoghegan
Date:
Subject: Re: Postgres: Queries are too slow after upgrading to PG17 from PG15