ALTER ROW LEVEL SECURITY POLICY modifies an existing row-level access control policy, including the policy name and the users and expressions affected by the policy.
Only the table owner or administrators can perform this operation.
1 2 3 4 5 | ALTER [ ROW LEVEL SECURITY ] POLICY [ IF EXISTS ] policy_name ON table_name RENAME TO new_policy_name ALTER [ ROW LEVEL SECURITY ] POLICY policy_name ON table_name [ TO { role_name | PUBLIC } [, ...] ] [ USING ( using_expression ) ] |
Specifies the name of a row-level access control policy to be modified.
Specifies the name of a table to which a row-level access control policy is applied.
Specifies the new name of a row-level access control policy.
Specifies names of users affected by a row-level access control policy will be applied. PUBLIC indicates that the row-level access control policy will affect all users.
Specifies an expression defined for a row-level access control policy. The return value is of the boolean type.
Change the name of the all_data_rls policy.
1 | ALTER ROW LEVEL SECURITY POLICY all_data_rls ON all_data RENAME TO all_data_new_rls; |
Change the users affected by the row-level access control policy.
1 | ALTER ROW LEVEL SECURITY POLICY all_data_new_rls ON all_data TO alice, bob; |
Modify the expression defined for the access control policy.
1 | ALTER ROW LEVEL SECURITY POLICY all_data_new_rls ON all_data USING (id > 100 AND role = current_user); |