aboutsummaryrefslogtreecommitdiff
path: root/src/include/commands/policy.h
diff options
context:
space:
mode:
authorJoe Conway <mail@joeconway.com>2015-07-28 16:24:09 -0700
committerJoe Conway <mail@joeconway.com>2015-07-28 16:24:09 -0700
commit344703bcc453ac3ce0060785d4958ddec7d2dbe9 (patch)
treec5b4b2cec7d60f0d402e11eff472c22b70c2e286 /src/include/commands/policy.h
parent992c9d345f6607c5b2cab2787f7cf72fba96673d (diff)
downloadpostgresql-344703bcc453ac3ce0060785d4958ddec7d2dbe9.tar.gz
postgresql-344703bcc453ac3ce0060785d4958ddec7d2dbe9.zip
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.
Diffstat (limited to 'src/include/commands/policy.h')
-rw-r--r--src/include/commands/policy.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/include/commands/policy.h b/src/include/commands/policy.h
index ac322e0db92..be000432312 100644
--- a/src/include/commands/policy.h
+++ b/src/include/commands/policy.h
@@ -31,5 +31,6 @@ extern Oid get_relation_policy_oid(Oid relid, const char *policy_name,
extern ObjectAddress rename_policy(RenameStmt *stmt);
+extern bool relation_has_policies(Relation rel);
#endif /* POLICY_H */