Michael Paquier <mich...@paquier.xyz> writes: > On Mon, Mar 10, 2025 at 09:07:59AM +0100, Anthonin Bonnefoy wrote: >> The issue seems to have been introduced by 2129d184a206c when >> transactionState->priorContext was added and is only present in HEAD.
> It seems to me that you mean 1afe31f03cd2, no? I dunno about this patch: it seems to me it's doing things exactly backwards, namely trying to restore the CurrentMemoryContext after a transaction abort to what it was just beforehand. With only a slightly different set of suppositions, this is introducing use of a deleted context rather than removing it. I'm inclined to suspect that the real problem is somebody installed the wrong context as current just before the transaction was started. I don't have the energy to look closer right now, though. Independently of where the actual bug is there, it seems not nice that it's so easy to bollix the memory context data structures. I wonder if we can make that more detectable at reasonable cost. regards, tom lane