DROP ROW ACCESS POLICY

从系统中移除行访问策略。

另请参阅:

行访问策略 DDL

语法

DROP ROW ACCESS POLICY [ IF EXISTS ] <name>
Copy

参数

name

行访问策略的标识符;对于您的账户必须是唯一的。

标识符值必须以字母字符开头,且不能包含空格或特殊字符,除非整个标识符字符串放在双引号内(例如 "My object")。放在双引号内的标识符也区分大小写。

有关更多详细信息,请参阅 标识符要求

访问控制要求

用于执行此操作的 角色 必须至少具有以下 权限

权限

对象

备注

OWNERSHIP

架构

行访问策略

包含行访问策略的架构。

OWNERSHIP is a special privilege on an object that is automatically granted to the role that created the object, but can also be transferred using the GRANT OWNERSHIP command to a different role by the owning role (or any role with the MANAGE GRANTS privilege).

The USAGE privilege on the parent database and schema are required to perform operations on any object in a schema. Note that a role granted any privilege on a schema allows that role to resolve the schema. For example, a role granted CREATE privilege on a schema can create objects on that schema without also having USAGE granted on that schema.

有关创建具有指定权限集的自定义角色的说明,请参阅 创建自定义角色

有关对 安全对象 执行 SQL 操作的相应角色和权限授予的一般信息,请参阅 访问控制概述

有关掩码策略 DDL 和权限的其他详细信息,请参阅 管理行访问策略

使用说明

  • 在删除行访问策略之前,请执行以下语句以确定是否将行访问策略应用于任何表或视图。有关更多信息,请参阅 POLICY_REFERENCES

    SELECT * from table(information_schema.policy_references(policy_name=>'<string>'));
    
    Copy
  • 如果行访问策略当前已附加到资源,则无法成功删除该策略。在执行 DROP 语句之前,请使用 ALTER TABLE 或 ALTER VIEW 语句将行访问策略与表或视图分离,如 ALTER TABLEALTER VIEW 中所示。

  • Snowflake 不支持行访问策略对象的 UNDROP。使用 UNDROP 会触发错误消息。有关此错误消息的详细信息,请参阅 行访问策略故障排除

  • 如果表列附加了行访问策略,则无法从表中删除该列。

  • 如果指定了 IF EXISTS 子句,而目标对象不存在,该命令会成功完成,不会返回错误。

  • You can drop a row access policy that's in use by a table inside a snapshot. In that case, you can't immediately use the table after you restore it from the snapshot. To use the restored table, run an ALTER TABLE ... DROP ALL ROW ACCESS POLICIES command after restoring it.

示例

以下示例从表中删除行访问策略。

DROP ROW ACCESS POLICY rap_table_employee_info;
Copy
语言: 中文