Re: Unexpected changes of CurrentResourceOwner and CurrentMemoryContext

Mihail Nikalayeu <mihailnikalayeu@gmail.com>

From: Mihail Nikalayeu <mihailnikalayeu@gmail.com>
To: Antonin Houska <ah@cybertec.at>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2025-09-12T22:57:52Z
Lists: pgsql-hackers
Hi!

> Hello, Antonin!
>
>     if (using_subtxn)
>     {
>        RollbackAndReleaseCurrentSubTransaction();
>        MemoryContextSwitchTo(ccxt);
>        CurrentResourceOwner = cowner;
>     }
>
> IIUC memory context is already switched above:
>
>     MemoryContext ecxt = MemoryContextSwitchTo(ccxt);
>

Finally realized RollbackAndReleaseCurrentSubTransaction leaves as
with TransactionAbortContext, so, nevermind :)

Commits

  1. Avoid unexpected changes of CurrentResourceOwner and CurrentMemoryContext