Re: Improving RLS planning - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Improving RLS planning
Date
Msg-id 19643.1478616318@sss.pgh.pa.us
Whole thread Raw
In response to Re: Improving RLS planning  (Stephen Frost <sfrost@snowman.net>)
Responses Re: Improving RLS planning  (Dean Rasheed <dean.a.rasheed@gmail.com>)
List pgsql-hackers
Stephen Frost <sfrost@snowman.net> writes:
> * Tom Lane (tgl@sss.pgh.pa.us) wrote:
>> * Since the planner is now depending on Query.hasRowSecurity to be set
>> whenever there are any securityQuals, I put in an Assert about that,
>> and promptly found three places in prepjointree.c and the rewriter where
>> we'd been failing to set it.  I have not looked to see if these represent
>> live bugs in existing releases, but they might.  Or am I misunderstanding
>> what the flag is supposed to mean?

> They're independent, actually.  securityQuals can be set via either
> security barrier view or from RLS, while hasRowSecurity is specifically
> for the RLS case.  The reason for the distinction is that changing your
> role isn't going to impact security barrier views at all, while it could
> impact what RLS policies are used.  See extract_query_dependencies().

OK.  In that case I'll need to adjust the patch so that the planner keeps
its own flag about whether the query contains any securityQuals; that's
easy enough.  But I'm still suspicious that the three places I found may
represent bugs in the management of Query.hasRowSecurity.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Stephen Frost
Date:
Subject: Re: Row level security implementation in Foreign Table in Postgres
Next
From: Stephen Frost
Date:
Subject: Re: Copying Permissions