ALTER RLS POLICY - Amazon Redshift
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 中国的 Amazon Web Services 服务入门 (PDF)

ALTER RLS POLICY

更改表上现有的行级别安全性策略。

超级用户和具有 sys:secadmin 角色的用户或角色可以更改策略。

语法

ALTER RLS POLICY policy_name USING ( using_predicate_exp );

参数

policy_name

策略的名称。

USING ( using_predicate_exp )

指定应用于查询的 WHERE 子句的筛选器。Amazon Redshift 会在查询级别的用户谓词之前应用策略谓词。例如,current_user = ‘joe’ and price > 10 限制 Joe 只能查看价格高于 10 美元的记录。

该表达式可以访问在 CREATE RLS POLICY 语句的 WITH 子句中声明的变量,该语句用于创建名为 policy_name 的策略。

示例

以下示例介绍了更改 RLS 策略。

-- 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');