]> granicus.if.org Git - postgresql/commit
Disallow converting a table to a view if row security is present.
authorJoe Conway <mail@joeconway.com>
Tue, 28 Jul 2015 23:24:01 +0000 (16:24 -0700)
committerJoe Conway <mail@joeconway.com>
Tue, 28 Jul 2015 23:24:01 +0000 (16:24 -0700)
commitd824e2800f66f6180189d973c720611855c6f619
tree2a2700c0a3180d82a5afb6a2d3e034ced3542867
parentf781a0f1d88411978c9df5f05cbb4f46aabe3d24
Disallow converting a table to a view if row security is present.

When DefineQueryRewrite() is about to convert a table to a view, it checks
the table for features unavailable to views.  For example, it rejects tables
having triggers.  It omits to reject tables having relrowsecurity or a
pg_policy record. Fix that. To faciliate the repair, invent
relation_has_policies() which indicates the presence of policies on a
relation even when row security is disabled for that relation.

Reported by Noah Misch. Patch by me, review by Stephen Frost. Back-patch
to 9.5 where RLS was introduced.
src/backend/commands/policy.c
src/backend/rewrite/rewriteDefine.c
src/include/commands/policy.h
src/test/regress/expected/rowsecurity.out
src/test/regress/sql/rowsecurity.sql