pgsql: RLS refactoring - Mailing list pgsql-committers

From Stephen Frost
Subject pgsql: RLS refactoring
Date
Msg-id E1ZbwEg-0004Ct-Qc@gemulon.postgresql.org
Whole thread Raw
Responses Re: pgsql: RLS refactoring  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-committers
RLS refactoring

This refactors rewrite/rowsecurity.c to simplify the handling of the
default deny case (reducing the number of places where we check for and
add the default deny policy from three to one) by splitting up the
retrival of the policies from the application of them.

This also allowed us to do away with the policy_id field.  A policy_name
field was added for WithCheckOption policies and is used in error
reporting, when available.

Patch by Dean Rasheed, with various mostly cosmetic changes by me.

Back-patch to 9.5 where RLS was introduced to avoid unnecessary
differences, since we're still in alpha, per discussion with Robert.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/22eaf35c1d247407b7cf1fffb310a26cd9b9ceb1

Modified Files
--------------
src/backend/commands/policy.c                      |   41 -
src/backend/executor/execMain.c                    |   20 +-
src/backend/nodes/copyfuncs.c                      |    1 +
src/backend/nodes/equalfuncs.c                     |    1 +
src/backend/nodes/outfuncs.c                       |    1 +
src/backend/nodes/readfuncs.c                      |    1 +
src/backend/rewrite/rewriteHandler.c               |    5 +-
src/backend/rewrite/rowsecurity.c                  |  816 ++++++++++----------
src/backend/utils/cache/relcache.c                 |    2 -
src/include/nodes/parsenodes.h                     |    1 +
src/include/rewrite/rowsecurity.h                  |    3 +-
.../test_rls_hooks/expected/test_rls_hooks.out     |   10 +-
src/test/modules/test_rls_hooks/test_rls_hooks.c   |    2 -
13 files changed, 447 insertions(+), 457 deletions(-)


pgsql-committers by date:

Previous
From: Stephen Frost
Date:
Subject: pgsql: Enforce ALL/SELECT policies in RETURNING for RLS
Next
From: Stephen Frost
Date:
Subject: pgsql: Enforce ALL/SELECT policies in RETURNING for RLS