Re: Unexpected changes of CurrentResourceOwner and CurrentMemoryContext - Mailing list pgsql-hackers

From Álvaro Herrera
Subject Re: Unexpected changes of CurrentResourceOwner and CurrentMemoryContext
Date
Msg-id 202509111800.kp6xfq6pnke7@alvherre.pgsql
Whole thread Raw
In response to Unexpected changes of CurrentResourceOwner and CurrentMemoryContext  (Antonin Houska <ah@cybertec.at>)
Responses Re: Unexpected changes of CurrentResourceOwner and CurrentMemoryContext
List pgsql-hackers
On 2025-Sep-03, Antonin Houska wrote:

> When working on the REPACK command, we see an ERROR caused by unexpected
> change of CurrentResourceOwner [1]. I think the problem is that
> reorderbuffer.c does not restore the original value after calling
> RollbackAndReleaseCurrentSubTransaction(). The attached patch tries to handle
> the call like other callers throughout the tree do.

I have registered this as
https://commitfest.postgresql.org/patch/6051/

I've been wondering whether this should be backpatched.  In principle
this is a bugfix, so it should, but I don't offhand recall any cases
where failure to set the current context/resowner in the other
reorderbuffer.c users causes a live bug, so ... maybe master only?  I'm
wondering if it's possible where anybody _depends_ on the current
behavior, but I suppose that's quite unlikely.

It applies cleanly back to 14, so I would probably stop there in any
case.  (A good thing also, because if we mess up 13 with it now and
don't notice until after the next minor is out, there won't be a chance
to unbreak it later.)

-- 
Álvaro Herrera         PostgreSQL Developer  —  https://www.EnterpriseDB.com/
Essentially, you're proposing Kevlar shoes as a solution for the problem
that you want to walk around carrying a loaded gun aimed at your foot.
(Tom Lane)



pgsql-hackers by date:

Previous
From: Pierrick
Date:
Subject: Re: Only one version can be installed when using extension_control_path
Next
From: Tom Lane
Date:
Subject: Re: plan shape work