Disallow converting a table to a view if row security is present.

Joe Conway <mail@joeconway.com>

Commit: d824e2800f66f6180189d973c720611855c6f619
Author: Joe Conway <mail@joeconway.com>
Date: 2015-07-28T23:24:01Z
Releases: 9.6.0
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.

Files