]> granicus.if.org Git - postgresql/commit
Use appropriate command type when retrieving relation's policies.
authorJoe Conway <mail@joeconway.com>
Thu, 30 Jul 2015 16:38:13 +0000 (09:38 -0700)
committerJoe Conway <mail@joeconway.com>
Thu, 30 Jul 2015 16:38:13 +0000 (09:38 -0700)
commit23b5e726da6ef5ebbc1dbc821320ee35fa1d0737
tree2c133b9d6fbc4bff2b3440f6beb70e261ce48b4e
parente91a1643ac723477d6ec2d47c8486cd0013660bb
Use appropriate command type when retrieving relation's policies.

When retrieving policies, if not working on the root target relation,
we actually want the relation's SELECT policies, regardless of
the top level query command type. For example in UPDATE t1...FROM t2
we need to apply t1's UPDATE policies and t2's SELECT policies.
Previously top level query command type was applied to all relations,
which was wrong. Add some regression coverage to ensure we don't
violate this principle in the future.

Report and patch by Dean Rasheed. Cherry picked from larger refactoring
patch and tweaked by me. Back-patched to 9.5 where RLS was introduced.
src/backend/rewrite/rowsecurity.c
src/test/regress/expected/rowsecurity.out
src/test/regress/sql/rowsecurity.sql