ALTER POLICY
Synopsis
Use the ALTER POLICY
statement to change the definition of an existing row level security policy. It can be used tochange the roles that the policy applies to and the USING
and CHECK
expressions of the policy.
Syntax
alter_policy ::= ALTER POLICY name ON table_name
[ TO { role_name
| PUBLIC
| CURRENT_USER
| SESSION_USER } [ , ... ] ]
[ USING ( using_expression ) ]
[ WITH CHECK ( check_expression ) ]
alter_policy_rename ::= ALTER POLICY name ON table_name RENAME TO
new_name
alter_policy
alter_policy_rename
Where
name
is the name of the policy being updated.table_name
is the name of the table on which the policy applies.new_name
is the new name of the policy.role_name
is the role(s) to which the policy applies. UsePUBLIC
if the policy should beapplied to all roles.using_expression
is a SQL conditional expression. Only rows for which the condition returns totrue will be visible in aSELECT
and available for modification in anUPDATE
orDELETE
.check_expression
is a SQL conditional expression that is used only forINSERT
andUPDATE
queries. Only rows for which the expression evaluates to true will be allowed in anINSERT
orUPDATE
. Note that unlikeusing_expression
, this is evaluated against the proposed new contentsof the row.
Examples
- Rename a policy.
yugabyte=# ALTER POLICY p1 ON table_foo RENAME TO p2;
- Apply policy to all roles.
yugabyte=# ALTER POLICY p1 ON table_foo TO PUBLIC;
See also
当前内容版权归 YugabyteDB 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 YugabyteDB .