Re: ExecRTCheckPerms() and many prunable partitions (checkAsUser) - Mailing list pgsql-hackers

From Justin Pryzby
Subject Re: ExecRTCheckPerms() and many prunable partitions (checkAsUser)
Date
Msg-id 20221211142158.GC27893@telsasoft.com
Whole thread Raw
In response to Re: ExecRTCheckPerms() and many prunable partitions (checkAsUser)  (Amit Langote <amitlangote09@gmail.com>)
List pgsql-hackers
On Sun, Dec 11, 2022 at 06:25:48PM +0900, Amit Langote wrote:
> On Sun, Dec 11, 2022 at 5:17 AM Justin Pryzby <pryzby@telsasoft.com> wrote:
> > The original code rechecks rte->checkAsUser with the rte of the parent
> > rel.  The patch changed to access onerel instead, but that's not updated
> > after looping to find the parent.
> >
> > Is that okay ?  It doesn't seem intentional, since "userid" is still
> > being recomputed, but based on onerel, which hasn't changed.  The
> > original intent (since 553d2ec27) is to recheck the parent's
> > "checkAsUser".
> >
> > It seems like this would matter for partitioned tables, when the
> > partition isn't readable, but its parent is, and accessed via a view
> > owned by another user?
> 
> Thanks for pointing this out.
> 
> I think these blocks which are rewriting userid to basically the same
> value should have been removed from these sites as part of 599b33b94.

I thought maybe; thanks for checking.

Little nitpicks:

001:
Fine to use the same userid as it's same in all
=> the same

002:
give that it's a subquery rel.
=> given

-- 
Justin



pgsql-hackers by date:

Previous
From: "houzj.fnst@fujitsu.com"
Date:
Subject: RE: Perform streaming logical transactions by background workers and parallel apply
Next
From: Andrew Dunstan
Date:
Subject: Re: Error-safe user functions