Construct a row level security policy
Usage
rls_construct_policy(
name,
table,
as = NULL,
command = NULL,
role = NULL,
using = NULL,
check = NULL
)
Arguments
- name
(character) name of the policy to be created. This must be distinct from the name of any other policy for the table. required
- table
(character) the table to apply the policy to. required
- as
(character) permissive (default) or restrictive. permissive combines with "OR" while restrictive combines with "AND"
- command
(character) the command to which the policy applies. Valid options are ALL (default), SELECT, INSERT, UPDATE, and DELETE
- role
(character) The role(s) to which the policy is to be applied. The default is PUBLIC, which will apply the policy to all roles.
- using
(character) Specifies a filter that is applied to the WHERE clause of a query. Rows for which the expression returns true will be visible. Any rows for which the expression returns false or null will not be visible to the user (in a SELECT), and will not be available for modification (in an UPDATE or DELETE). Such rows are silently suppressed; no error is reported.
- check
(character) the check condition; any SQL conditional expression that returns a boolean. This expression will be used in INSERT and UPDATE queries against the table if row-level security is enabled. Only rows for which the expression evaluates to true will be allowed. Is evaluated against the proposed new contents of the row, not the original contents