Re: ExecRTCheckPerms() and many prunable partitions (checkAsUser)

From: Justin Pryzby <pryzby(at)telsasoft(dot)com>
To: Amit Langote <amitlangote09(at)gmail(dot)com>
Cc: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, Ian Lawrence Barwick <barwick(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, David Rowley <dgrowleyml(at)gmail(dot)com>, Greg Stark <stark(at)mit(dot)edu>, Julien Rouhaud <rjuju123(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: ExecRTCheckPerms() and many prunable partitions (checkAsUser)
Date: 2022-12-11 14:21:58
Message-ID: 20221211142158.GC27893@telsasoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)telsasoft(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2022-12-11 14:35:40 Re: Error-safe user functions
Previous Message houzj.fnst@fujitsu.com 2022-12-11 11:44:55 RE: Perform streaming logical transactions by background workers and parallel apply