Enforce ALL/SELECT policies in RETURNING for RLS
authorStephen Frost <sfrost@snowman.net>
Tue, 15 Sep 2015 19:49:31 +0000 (15:49 -0400)
committerStephen Frost <sfrost@snowman.net>
Tue, 15 Sep 2015 19:49:31 +0000 (15:49 -0400)
commit4f3b2a8883c47b6710152a8e157f8a02656d0e68
tree42a6608ea32f7d3cb1e69d73234ae2bdf4198d74
parent22eaf35c1d247407b7cf1fffb310a26cd9b9ceb1
Enforce ALL/SELECT policies in RETURNING for RLS

For the UPDATE/DELETE RETURNING case, filter the records which are not
visible to the user through ALL or SELECT policies from those considered
for the UPDATE or DELETE.  This is similar to how the GRANT system
works, which prevents RETURNING unless the caller has SELECT rights on
the relation.

Per discussion with Robert, Dean, Tom, and Kevin.

Back-patch to 9.5 where RLS was introduced.
src/backend/rewrite/rowsecurity.c
src/test/regress/expected/rowsecurity.out