Re: Restore CurrentUserId only if 'prevUser' is valid when abort transaction

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Richard Guo <riguo(at)pivotal(dot)io>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Restore CurrentUserId only if 'prevUser' is valid when abort transaction
Date: 2018-10-23 05:40:30
Message-ID: 20181023054030.GD1658@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dilip Kumar 2018-10-23 06:33:15 Re: Side effect of CVE-2017-7484 fix?
Previous Message Tsunakawa, Takayuki 2018-10-23 05:33:29 RE: WAL archive (archive_mode = always) ?