Re: BUG #19026: ResourceOwnerForget can't find owner for invalid plancache

Kirill Reshke <reshkekirill@gmail.com>

From: Kirill Reshke <reshkekirill@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Dilip Kumar <dilipbalaut@gmail.com>, exclusion@gmail.com, pgsql-bugs@lists.postgresql.org
Date: 2025-08-20T17:35:48Z
Lists: pgsql-bugs

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Fix re-execution of a failed SQLFunctionCache entry.

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