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

From: Amit Langote <amitlangote09(at)gmail(dot)com>
To: Justin Pryzby <pryzby(at)telsasoft(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-12 06:23:22
Message-ID: CA+HiwqGwirtFkVLWn1_LGE=xvT03v8_4OhT=XkjADTLuYMwayQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Dec 11, 2022 at 6:25 PM Amit Langote <amitlangote09(at)gmail(dot)com> wrote:
> I've attached 0001 to remove those extraneous code blocks and add a
> comment mentioning that userid need not be recomputed.
>
> While staring at the build_simple_rel() bit mentioned above, I
> realized that this code fails to set userid correctly in the
> inheritance parent rels that are child relations of subquery parent
> relations, such as UNION ALL subqueries. In that case, instead of
> copying the userid (= 0) of the parent rel, the child should look up
> its own RTEPermissionInfo, which should be there, and use the
> checkAsUser value from there. I've attached 0002 to fix this hole. I
> am not sure whether there's a way to add a test case for this in the
> core suite.

Ah, I realized we could just expand the test added by 553d2ec27 with a
wrapper view (to test checkAsUser functionality) and a UNION ALL query
over the view (to test this change).

I've done that in the attached updated patch, in which I've also
addressed Justin's comments.

--
Thanks, Amit Langote
EDB: http://www.enterprisedb.com

Attachment Content-Type Size
v2-0001-Remove-some-dead-code-in-selfuncs.c.patch application/octet-stream 2.3 KB
v2-0002-Correctly-set-userid-of-subquery-rel-s-child-rels.patch application/octet-stream 6.2 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Drouvot, Bertrand 2022-12-12 06:58:25 Re: Checksum errors in pg_stat_database
Previous Message Kyotaro Horiguchi 2022-12-12 05:54:09 Re: Time delayed LR (WAS Re: logical replication restrictions)