On Fri, Sep 8, 2017 at 3:18 AM, Robert Haas <robertmh...@gmail.com> wrote:
> On Mon, Sep 4, 2017 at 5:46 AM, Amit Kapila <amit.kapil...@gmail.com> wrote:
>> It seems like the consensus is to move forward with this approach.  I
>> have written a patch implementing the above idea.  Note, that to use
>> SetCurrentRoleId, we need the value of guc "is_superuser" for the
>> current user and we don't pass this value to parallel workers as this
>> is PGC_INTERNAL guc variable.  So, I have passed this value via
>> FixedParallelState.
>
>
> With your patch, the order is wrong.  SetCurrentRoleId() is called
> AFTER SetUserIdAndSecContext().  Furthermore, the role ID passed to
> SetCurrentRoleId() is always the same one passed to
> SetUserIdAndSecContext().  But those roles might be different.
> fps->current_user_id is set by a call to GetUserIdAndSecContext(),
> which reads CurrentUserId, not OuterUserId.  I think you need to pass
> the value returned by GetCurrentRoleId() as an additional element of
> FixedParallelState.
>

You are right.  I have changed the ordering and passed OuterUserId via
FixedParallelState.


-- 
With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com

Attachment: fix_role_handling_parallel_worker_v2.patch
Description: Binary data

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to