Re: Restore CurrentUserId only if 'prevUser' is valid when aborttransaction - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: Restore CurrentUserId only if 'prevUser' is valid when aborttransaction
Date
Msg-id 20181023054030.GD1658@paquier.xyz
Whole thread Raw
In response to Re: Restore CurrentUserId only if 'prevUser' is valid when abort transaction  (Richard Guo <riguo@pivotal.io>)
Responses Re: Restore CurrentUserId only if 'prevUser' is valid when aborttransaction  (Michael Paquier <michael@paquier.xyz>)
List pgsql-hackers
On Fri, Oct 12, 2018 at 02:28:36PM +0800, Richard Guo wrote:
> I think it is a better idea to avoid adjusting the state to TRANS_INPROGRESS
> from TRANS_START when aborting a transaction, as your patch does, since its
> only purpose is to suppress warning message.

Actually, as StartSubTransaction also switches to TRANS_START for a
savepoint, if there is an error until the state is switched to
TRANS_INPROGRESS then the code would fail to switch back to
CurrentUserId even if it is set, and it should be switched.  So that
solution is not correct either as AtSubStart_ResourceOwner() or such
could fail on memory allocation.  That's unlikely going to happen, but
it could.
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: "Tsunakawa, Takayuki"
Date:
Subject: RE: WAL archive (archive_mode = always) ?
Next
From: Dilip Kumar
Date:
Subject: Re: Side effect of CVE-2017-7484 fix?