pgsql: Collect the global OR of hasRowSecurity flags for plancache

From: Stephen Frost <sfrost(at)snowman(dot)net>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Collect the global OR of hasRowSecurity flags for plancache
Date: 2015-12-15 01:06:07
Message-ID: E1a8e47-0000mK-Uh@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Collect the global OR of hasRowSecurity flags for plancache

We carry around information about if a given query has row security or
not to allow the plancache to use that information to invalidate a
planned query in the event that the environment changes.

Previously, the flag of one of the subqueries was simply being copied
into place to indicate if the query overall included RLS components.
That's wrong as we need the global OR of all subqueries. Fix by
changing the code to match how fireRIRules works, which is results
in OR'ing all of the flags.

Noted by Tom.

Back-patch to 9.5 where RLS was introduced.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/e5e11c8cca7ae298895430102217fa6d77cfb2a3

Modified Files
--------------
src/backend/optimizer/plan/planner.c | 3 +-
src/backend/optimizer/plan/setrefs.c | 3 +-
src/test/regress/expected/rowsecurity.out | 154 ++++++++++++++++++++++++++++-
src/test/regress/sql/rowsecurity.sql | 24 ++++-
4 files changed, 180 insertions(+), 4 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Stephen Frost 2015-12-15 15:08:37 pgsql: Improve CREATE POLICY documentation
Previous Message Tom Lane 2015-12-15 00:22:58 pgsql: Add missing cleanup logic in pg_rewind/t/005_same_timeline.pl te