ALTER RLS POLICY - Amazon Redshift

ALTER RLS POLICY

Alter an existing row-level security policy on a table.

Superusers and users or roles that have the sys:secadmin role can alter a policy.

Syntax

ALTER RLS POLICY policy_name USING ( using_predicate_exp );

Parameters

policy_name

The name of the policy.

USING ( using_predicate_exp )

Specifies a filter that is applied to the WHERE clause of the query. Amazon Redshift applies a policy predicate before the query-level user predicates. For example, current_user = ‘joe’ and price > 10 limits Joe to see only records with the price greater than $10.

The expression has access to the variables declared in the WITH clause of the CREATE RLS POLICY statement that was used to create the policy with name policy_name.

Examples

The following example alters a RLS policy.

-- First create an RLS policy that limits access to rows where catgroup is 'concerts'. CREATE RLS POLICY policy_concerts WITH (catgroup VARCHAR(10)) USING (catgroup = 'concerts'); -- Then, alter the RLS policy to only show rows where catgroup is 'piano concerts'. ALTER RLS POLICY policy_concerts USING (catgroup = 'piano concerts');