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

From: Richard Guo <riguo(at)pivotal(dot)io>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Restore CurrentUserId only if 'prevUser' is valid when abort transaction
Date: 2018-10-10 07:37:50
Message-ID: CAN_9JTxECSb=pEPcb0a8d+6J+bDcOZ4=DgRo_B7Y5gRHJUM=Rw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

This is a follow-up to the issue described in thread
https://www.postgresql.org/message-id/CAMbWs4-Mys%3DhBQSevTA8Zpd-TYFnb%3DXuHhN2TnktXMsfMUbjiQ%40mail.gmail.com

In short, during the first transaction starting phase within a backend, if
there is an 'ereport' after setting transaction state but before saving
CurrentUserId into 'prevUser' in TransactionStateData, 'prevUser' will
remain
as InvalidOid. Then in AbortTransaction(), CurrentUserId is restored with
'prevUser'. As a result, CurrentUserId will be InvalidOid in the rest of the
session.

Attached is a patch that fixes this issue.

Thanks
Richard

Attachment Content-Type Size
0001-Restore-CurrentUserId-only-if-prevUser-is-valid.patch application/octet-stream 1.7 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message legrand legrand 2018-10-10 07:59:16 Re: [Proposal] Add accumulated statistics for wait event
Previous Message Imai, Yoshikazu 2018-10-10 07:28:19 RE: Why we allow CHECK constraint contradiction?