RLS support for ON CONFLICT UPDATE
authorPeter Geoghegan <pg@heroku.com>
Wed, 7 Jan 2015 00:32:21 +0000 (16:32 -0800)
committerPeter Geoghegan <peter.geoghegan86@gmail.com>
Mon, 27 Apr 2015 00:58:27 +0000 (17:58 -0700)
commit0bed7a33e1a3911c03eb259fee16c66b5efa6a6c
tree1e4319dda9a7922e95e7b0cf173a958b5eaf6b80
parent2cc27182ff273e2e7bddf8b44de10e88cda776a2
RLS support for ON CONFLICT UPDATE

This commit establishes that only insert policies are enforced on
post-insert tuples (as before), only update USING/security barrier quals
are enforced (as WCOs, with errors thrown) on existing TARGET.* tuples
(before ON CONFLICT UPDATE), and post-update tuple only has WCO
enforcement (without USING/security barrier qual enforcement).

In general, the implementation treats RLS with INSERT ... ON CONFLICT
UPDATE as close to regular INSERT/UPDATE behavior as possible.  The
consistent enforcement of USING/security barrier qualifications as WCOs
is the only real deviation.

Note to committer to authoritative master branch:  This commit is
intended to be squashed into the main ON CONFLICT UPDATE commit.  It has
only been split out for easier review by subject matter experts.
doc/src/sgml/ref/create_policy.sgml
src/backend/executor/execMain.c
src/backend/executor/nodeModifyTable.c
src/backend/rewrite/rowsecurity.c
src/include/nodes/parsenodes.h
src/test/regress/expected/rowsecurity.out
src/test/regress/sql/rowsecurity.sql